Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
Level II

## How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

Is it possible to create a bar-mekko chart in JMP? see e.g.

I can create a bar chart with categories on the X-axis and Numerical on the Y-axis, and sort ascending. Then, intuitively, dragging another numerical column to the "Size" field should create such a chart (Size = widths of the bars in the chart?) but nothing happens if I do that. I can only color the bars instead, i.e. dragging to the "Color" field in the Graph builder.

Thanks in advance for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Staff

## Re: How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

Two options that I can think of (neither is a bar chart) that would get you close are:

1) don't use bars. Stick with a scatterplot and set the size of the point to be the production size. That would give you something like this:

2) use Fit Y by X, put the Production Size in as a Frequency variable (Fit Y by X has an X-axis proportional default setting). That gives you something like this:

You could play around with some additional options to try and make them look a bit better.

Of course you could always write a script to do this.

Dan Obermiller
7 REPLIES 7
Highlighted
Staff

## Re: How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

I'd try a packed bar chart - it's one of the options for bar charts in JMP 14.

https://community.jmp.com/t5/JMP-Blog/Introducing-packed-bars-a-new-chart-form/ba-p/39972
Highlighted
Level II

## Re: How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

Thanks Mike, I had looked at that but this is not really what I intend here. Also, packed bars get very confusing because unrelated categories are mixed. The variable width bar charts are very common in the mining / oil & gas world, e.g. production cost on the y-axis, mine/well name as category on the x-axis, and mine/well production size as bar width. Would be cool if this could be added in the graph builder at some point (like I described via dragging a column on the size field with a bar chart).

Highlighted
Staff

## Re: How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

Two options that I can think of (neither is a bar chart) that would get you close are:

1) don't use bars. Stick with a scatterplot and set the size of the point to be the production size. That would give you something like this:

2) use Fit Y by X, put the Production Size in as a Frequency variable (Fit Y by X has an X-axis proportional default setting). That gives you something like this:

You could play around with some additional options to try and make them look a bit better.

Of course you could always write a script to do this.

Dan Obermiller
Highlighted
Level II

## Re: How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

Thanks Dan, I will try the scripting and the suggested alternatives.

Highlighted
Super User

## Re: How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

Attached is a very simple script that builds on Dan's suggestion. It shows how to make bars instead of points. I tested it on JMP 12, 13 and 14.

If I were building an application, I'd create a summary table based upon user input and likely build the graph using Shape Seg with rowstates associated with the table.

Highlighted
Super User

## Re: How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

Oh, one more suggestion. Mosaic plots scale by N/Weight. You might want to resarch them in the Scripting Index.

Names Default To Here( 1 );
dt = Open( "\$SAMPLE_DATA/Big Class.jmp" );
obj = Distribution( Column( :Age ) );
obj << Mosaic Plot( 1 );

Highlighted
Community Manager

## Re: How to create a bar-mekko chart (variable width bar chart) in JMP / Graph Builder

Starting with JMP 16 the bars element will support the size role to allow for this kind of chart.

-Jeff
Article Labels

There are no labels assigned to this post.