BookmarkSubscribe
Choose Language Hide Translation Bar
Rajat
Contributor

Range plot in JMP

I have a data with all min and max values. How would I plot the range for each variable in graph builder. I want my output as shown in attached image. Below is the sample data.

SchoolSubjectMin(Hours)Max(Hours)Min(Students)Max(Students)
APhysics383055
AChemistry293452
AMath573253
BPhysics283060
BChemistry483065
BMath683163

 

1.jpeg

If you can share the procedure or JSL script, that would be great help.

 

Thanks

0 Kudos
2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Range plot in JMP

This basic chart type is one of many that is covered in the JMP guide. See Help > Books > Essential Graphing.

Learn it once, use it forever!
julian
Staff

Re: Range plot in JMP

Hi @Rajat,

 

As @markbailey suggested, the Essentials of Graphing book is a great read and will explain in more detail this and other plots. But, I see there being two complexities in your plot that might take a little extra work, which is that you want a range area plot with steps not a polygon fill, and you want a column switcher operational for switching a pair of variables. Here's how I would approach this. 

 

First, for the basic plot, you can accomplish this using the Bar element with a Range style. Here's what that will look like:

 

min and max.png

 

Here's a video showing the steps:

(view in My Videos)

 

and the JSL, also saved to the attached table:

 


Graph Builder(
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Graph Spacing( 10 ),
	Variables(
		X( :Subject ),
		Y( :Name( "Min(Hours)" ) ),
		Y( :Name( "Max(Hours)" ), Position( 1 ) ),
		Group X( :School )
	),
	Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 4 ), Bar Style( "Range" ) ) ),
	SendToReport(
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "Min and Max Hours by Subject and School" )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "Hours" )} ),
		Dispatch( {}, "Graph Builder", FrameBox, {DispatchSeg( BarSeg( 1 ), Set Width Proportion( 1 ) )} ),
		Dispatch( {}, "Graph Builder", FrameBox( 2 ), {DispatchSeg( BarSeg( 1 ), Set Width Proportion( 1 ) )} )
	)
);

However, what you'll notice is that if you try to add a column switcher, you have the option to switch only one variable, but in your case, you need to switch out two, since that is what defines your range. You could add two Column Switchers, but I tend to not like that method, as it ends up looking like this, where you need to toggle two separate items: Screen Shot 2019-06-11 at 8.14.55 AM.png

You can make this plot work with a single Column Switcher-like operation, but need to do a little restructuring of your table via Tables > Stack. Here's how you will set that up:

Screen Shot 2019-06-11 at 7.53.24 AM.png

This will give you the following table, which you will notice has taken your pairs of columns that represent the different outcome variable and stacked them on top of each other (and you'll see I had to use the multiple series stack here, series being the term for a set of columns that define a variable):

Screen Shot 2019-06-11 at 8.09.55 AM.pngNow that we have that table, we can produce the plot as before (with the appropriate changes to which columns you use, since they're named differently now), and then, invoke not the column switcher, but the Local Data Filter, and pick either the Variable 1 or Variable 2 column (they're identical). Now, when you filter to show just one level of that variable you are showing just one pair of the outcome variables, thus a switch between Hours and Students:

switcher.gif

 

 

I hope this helps

@julian 

 

 

 

 

3 REPLIES 3

Re: Range plot in JMP

This basic chart type is one of many that is covered in the JMP guide. See Help > Books > Essential Graphing.

Learn it once, use it forever!
julian
Staff

Re: Range plot in JMP

Hi @Rajat,

 

As @markbailey suggested, the Essentials of Graphing book is a great read and will explain in more detail this and other plots. But, I see there being two complexities in your plot that might take a little extra work, which is that you want a range area plot with steps not a polygon fill, and you want a column switcher operational for switching a pair of variables. Here's how I would approach this. 

 

First, for the basic plot, you can accomplish this using the Bar element with a Range style. Here's what that will look like:

 

min and max.png

 

Here's a video showing the steps:

(view in My Videos)

 

and the JSL, also saved to the attached table:

 


Graph Builder(
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Graph Spacing( 10 ),
	Variables(
		X( :Subject ),
		Y( :Name( "Min(Hours)" ) ),
		Y( :Name( "Max(Hours)" ), Position( 1 ) ),
		Group X( :School )
	),
	Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 4 ), Bar Style( "Range" ) ) ),
	SendToReport(
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "Min and Max Hours by Subject and School" )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "Hours" )} ),
		Dispatch( {}, "Graph Builder", FrameBox, {DispatchSeg( BarSeg( 1 ), Set Width Proportion( 1 ) )} ),
		Dispatch( {}, "Graph Builder", FrameBox( 2 ), {DispatchSeg( BarSeg( 1 ), Set Width Proportion( 1 ) )} )
	)
);

However, what you'll notice is that if you try to add a column switcher, you have the option to switch only one variable, but in your case, you need to switch out two, since that is what defines your range. You could add two Column Switchers, but I tend to not like that method, as it ends up looking like this, where you need to toggle two separate items: Screen Shot 2019-06-11 at 8.14.55 AM.png

You can make this plot work with a single Column Switcher-like operation, but need to do a little restructuring of your table via Tables > Stack. Here's how you will set that up:

Screen Shot 2019-06-11 at 7.53.24 AM.png

This will give you the following table, which you will notice has taken your pairs of columns that represent the different outcome variable and stacked them on top of each other (and you'll see I had to use the multiple series stack here, series being the term for a set of columns that define a variable):

Screen Shot 2019-06-11 at 8.09.55 AM.pngNow that we have that table, we can produce the plot as before (with the appropriate changes to which columns you use, since they're named differently now), and then, invoke not the column switcher, but the Local Data Filter, and pick either the Variable 1 or Variable 2 column (they're identical). Now, when you filter to show just one level of that variable you are showing just one pair of the outcome variables, thus a switch between Hours and Students:

switcher.gif

 

 

I hope this helps

@julian 

 

 

 

 

Rajat
Contributor

Re: Range plot in JMP

Thanks @julian,
Its a great help.
0 Kudos