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

How to show Min of A and Max of B on Line Plot

Hi,

 

My data is on 1 same column. but have Product A, B & C.

 

Can I use Line plot to show one line for Max of A and another lines for Min of B.

I can just sort out C's data. But to show Min on one line and Max on one line seems not possible as there is only 1 option.

 

 

 

1 REPLY 1
ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to show Min of A and Max of B on Line Plot

Hi @XiangXing, here are two options:

 

One option is to use the Split option under the Tables menu to make separate columns for A and B (split column EH, split by Platform).  The, you would use two different lines in graph builder.  Build your chart but add both columns to the y axis in graph builder.  Right click in the chart area and choose Add > Line. Now in the area where you chose Min you will see two different lines, choose min for one and max for the other.  You should see four lines on the chart, the min of A and B, and the max of A and B. Now under 'Variables' below where you picked Min, deselect B from the Max, and deselect A from Min.

 

ih_0-1661775585915.png

 

Another option is to build the graph with lines for both min and max for all levels of Platform and just hide the lines you don't want. In the chart you showed in your post, add a second line the same way you did in the previous option and change one line to min and one to max.  Now go to legend settings, check the boxes to display all four labels, then work out which lines are the min and max for each one and change their transparency to 0. Now go back to legend settings and hide the transparent labels.

ih_1-1661775597280.png

Here is a script that should recreate these two charts:

View more...
Names Default To Here( 1 );

dt = Open( "$Sample_data/big class.jmp" );

dt:age << Set Name( "Description" );
dt:sex << Set Name( "Platform" );
dt:height << Set Name( "EH" );
dt:Platform[loc(dt:Platform << get values,"M")] = "A";
dt:Platform[loc(dt:Platform << get values,"F")] = "B";

Graph Builder(
	Size( 528, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Description ), Y( :EH ), Overlay( :Platform ) ),
	Elements(
		Line( X, Y, Legend( 9 ), Summary Statistic( "Min" ) ),
		Line( X, Y, Legend( 10 ), Summary Statistic( "Max" ) )
	),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				9,
				Properties( 0, {Transparency( 0 )}, Item ID( "A", 1 ) )
			), Legend Model(
				10,
				Base( 0, 0, 0, Item ID( "A", 1 ) ),
				Base( 1, 0, 0, Item ID( "B", 1 ) ),
				Properties( 1, {Transparency( 0 )}, Item ID( "B", 1 ) )
			)}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {9, [-1, 0], 10, [1, -1]} )}
		)
	)
);

dtSplit = dt << Split(
	Split By( :Platform ),
	Split( :EH ),
	Group( :name, :Description, :weight ),
	Sort by Column Property
);

dtSplit << Graph Builder(
	Size( 528, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Description ), Y( :A ), Y( :B, Position( 1 ) ) ),
	Elements(
		Line( X, Y( 2 ), Legend( 4 ), Summary Statistic( "Min" ) ),
		Line( X, Y( 1 ), Legend( 5 ), Summary Statistic( "Max" ) )
	)
);