cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Ripple
Level I

Make size of bubbles in bubble plot proportional to count

I have a bubble plot in which each axis is a different, discrete list of mutually-exclusive text descriptors for the data (for instance, imagine a table of vehicle attributes where the X axis has different vehicle size classifications like subcompact, compact, sedan, etc. and the Y axis has cost descriptors such as bargain, relatively inexpensive, average cost, relatively expensive, and uber-expensive).  I want the size of each bubble to be proportional to the total number of times that that combination of X and Y values appears in my data table.  How do I do this?  Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Make size of bubbles in bubble plot proportional to count

I am not sure if this is what you are looking for, but given the information you specified, and the rules for the Bubble Plot, you will need to create a new column that represents the values you want to use for the size, and then specify the new column as the "Sizes" column to the Bubble Plot.

 

 

Jim

View solution in original post

7 REPLIES 7
txnelson
Super User

Re: Make size of bubbles in bubble plot proportional to count

I am not sure if this is what you are looking for, but given the information you specified, and the rules for the Bubble Plot, you will need to create a new column that represents the values you want to use for the size, and then specify the new column as the "Sizes" column to the Bubble Plot.

 

 

Jim
Ripple
Level I

Re: Make size of bubbles in bubble plot proportional to count

Thanks - that makes sense, although I was hoping there would be a way for JMP to do it automatically.  The only minor hassle is that I haven't yet found an equivalent formula in JMP to Excel's SUMPRODUCT that would make doing those tallies easy - but I can do that in Excel and bring the data in.

txnelson
Super User

Re: Make size of bubbles in bubble plot proportional to count

The JMP equivalent to the SumProduct function in Excel is:

Sum(A:*B)

Where both A and B are matricies.  The issue with this, is the defining of the matricies.  Below is a script that  takes two approaches to doing the SumProduct on the sample data table "Big Class".  My assumption is that you will need to calculate the SumProduct for different rows, based upon a grouping value in another column.  The first approach uses a single column to do the SumProduct, using the above approach, calculating the SumProduct separatly for the values of the column Sex.  The second approach uses 2 columns.  The first column calculates the product, and the second column calculates the sum of those products for the column Sex.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

// Create the SumProduct in one formula
dt << New Column( "SumProduct",
	formula(
		dt = Current Data Table();
		gender = :sex[Row()];
		TheRows = dt << get rows where( :sex == gender );
		aMat = dt:height[TheRows];
		bMat = dt:weight[TheRows];
		Sum( aMat :* bMat );
	)
);

// Create the SumProduct using 2 column formulas
dt << New Column( "Product", formula( :height * :weight ) );
dt << New Column( "ColSum", formula( Col Sum( :Product, :sex ) ) );
Jim
Jeff_Perkinson
Community Manager Community Manager

Re: Make size of bubbles in bubble plot proportional to count

You can do this. You just need to summarize the data first.

 

Here's the Car Poll data from the Sample Data.

 

JMPScreenSnapz128.png

 

Then go to Tables->Summary and group it by Marital Status and Type.

 

JMPScreenSnapz129.png

 

which gets you this:

 

JMPScreenSnapz130.png

 

and now, use Bubble Plot with Marital Status on Y, Type on X and N Rows as Size.

 

JMPScreenSnapz131.png

 

On the other hand, I'm not sure that's the best visualization for this type of data. Starting with the original Car Poll data (no need to summarize) you can use Graph Builder with Marital Status on the Y and Type on the X and use the Mosaic element.

 

JMPScreenSnapz132.png

-Jeff
Ripple
Level I

Re: Make size of bubbles in bubble plot proportional to count

txnelson & Jeff -

Thank you both very much - those are all methods I'll pursue.

Ripple

WineAroma
Level III

Re: Make size of bubbles in bubble plot proportional to count

@Jeff_Perkinson  Is there anyway to create a similar graph in the "graph builder" WITHOUT creating a new table? 

 

x=Type, Y=Martial Status, Bubble Size = N Rows

 

If I graph from the new table, "R^2" changes, so I need to create one graph using the original data, then create another graph using the summarized new table for visualization. It would be lovely if I can do both in one graph.

 

Cheers!

Lei

txnelson
Super User

Re: Make size of bubbles in bubble plot proportional to count

Here is a Graph Builder Bubble Chart using the Car Poll data, without creating a new data table.  Instead, it uses a Transform variable created within the Graph Builder.

bubble.PNG

I created the chart interactively, and then used Save Script for the script below.  I did add to the script the first 2 lines.

names default to here(1);
dt=open("$SAMPLE_DATA/Car Poll.jmp");
Graph Builder(
	Size( 534, 450 ),
	Show Control Panel( 0 ),
	Variables(
		X( :type ),
		Y( :marital status ),
		Overlay( :marital status ),
		Size(
			Transform Column(
				"Count",
				Formula( Col Number( :age, :marital status, :type ) )
			),
			Summary Statistic( "Mean" )
		)
	),
	Elements( Points( X, Y, Legend( 8 ), Summary Statistic( "Mean" ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				8,
				Properties( 0, {Marker Size( 15 )}, Item ID( "Count", 1 ) ),
				Properties( 1, {Line Color( 0 )}, Item ID( "Married", 1 ) ),
				Properties( 2, {Line Color( 0 )}, Item ID( "Single", 1 ) )
			)}
		)
	)
);
Jim