cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Deez_Data
Level I

How to plot subset of rows together with different subset of same rows?

Note: I'm trying to do this with the interface only. Haven't tried scripting yet. 


I have multiple objects that have a bunch of measurements within each object. There are 6 objects total, numbered 1-6. Per each object, there are a few dozen rows. And the columns list various attributes. The short version of what I want to achieve is that I'd like to have the grouping feature, but instead of one group for each of the 6 objects, I'd like to split the groups up differently. 

 

Longer description is as follows. I want to plot one of the attributes (values in one of the columns) for one of the objects and compare that same attribute for all the other objects on the same plot. Let's say I want to plot the values for object 1 in a scatter plot. I have the variable for the value I'm interested in on the y-axis and "Object 1" on the x-axis. Next to it I want to plot the values of all the other 5 objects in the same manner, but I want them clearly separated, so that it's obvious that Object 1 is in a separate group, while the other 5 objects are in a different group. This separation should be at least visual and ideally also allow me to apply separate statistics, like obtaining separate mean, etc., like how the grouping feature functions--the one that is activated by dragging a label to the top x-axis in Graph Builder.

 

Is the only method to come up with some new column and create a label for all the 5 objects as one category, and the 1 other object as another category, and then group them by those categories using the grouping feature? 

3 REPLIES 3
txnelson
Super User

Re: How to plot subset of rows together with different subset of same rows?

All you need to do is to create a new column, and in the new column.  Try using Recode to do that

Here is an example using the Sample data table Big Class.  The objective is to display all 12 year olds vs all non 12 year olds.

 

txnelson_0-1677042052681.png

txnelson_2-1677042358669.png

 

 

Then open Graph Builder and create your graph.  Then drag the new column Age 2 to the X Group drop area

txnelson_1-1677042252602.png

 

Jim

Re: How to plot subset of rows together with different subset of same rows?

As a dynamic extension to what Jim recommends, my favorite way to do this is as follows:

1) add a new column to the table, name it "Selected", make it nominal, and add to it the formula 

 

Selected ( Row State ( ) )

 

This column will have 1 for any selected row, and 0 for any unselected row, and will update automatically as you make various selections.

 

brady_brady_0-1677787678497.png

 

2) In graph builder, drag this new "Selected" column to the x-axis.

If you have no rows selected in your table, you'll get something like this:

brady_brady_1-1677787810224.png

 

3) As soon as you select anything (even within this very graph), you'll get this:

 

brady_brady_2-1677787848079.png

 

Exactly HOW you make the selection, is completely up to you. You can make the selection whatever you wish, and you'll always see what you've selected, vs everything else. 

 

 

hogi
Level XI

Re: How to plot subset of rows together with different subset of same rows?

And if you want to compare one group with many others, you could put the selected() into GroupX to separate the selected group clearly from the other 5.

hogi_0-1677795686507.png

 

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column( "selected", Numeric, "Nominal", Formula( Selected() ) );
Graph Builder(
	Show Control Panel( 0 ),
	Variables(
		X( :age ),
		Y( :height ),
		Group X( :selected ),
		Overlay( :selected ),
		Color( :age )
	),
	Elements( Box Plot( X, Y, Legend( 14 ) ) ),
);