cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
anne_sa
Level VI

Graph Builder: reference line, different for each Y group

Hello everybody,

 

I would like to know if it is possible to define separated reference lines on the X axis when we have Y groups.

Here is an example using the BigClass data table.

I can define two reference lines, but I would like to display the red one only on the top graph and the blue one on the bottom graph.

anne_sa_2-1643367128821.png

 

Here is what I get:

anne_sa_0-1643366681245.png

 

Here is what I would like to get:

anne_sa_1-1643366773099.png

 

Is there a way to do that without playing with the menu Customize > Script ...?

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XIII

Re: Graph Builder: reference line, different for each Y group

and here an option with no JSL:
use a  "bar" graph  (with "float" style) with Response axis = X

hogi_1-1769199507139.png

 

hogi_0-1769199475772.png

 

View more...
"no JSL" - but here it is:

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// via right click - new formula column
New Column( "Mean[height][sex]",	Formula( Col Mean( :height, :sex ) )); 


Graph Builder(
	Variables(
		X( :height ),
		X( :"Mean[height][sex]"n, Position( 1 ) ),
		Y( :weight ),
		Group Y( :sex ),
		Color( :sex )
	),
	Elements(
		Points( X( 1 ), Y),
		Smoother( X( 1 ), Y ),
		Bar( X( 2 ), Bar Style( "Float" ), Response Axis( "X" ) )
	)
);
 

View solution in original post

6 REPLIES 6
ian_jmp
Level X

Re: Graph Builder: reference line, different for each Y group

Graph Builder is designed to facilitate comparisons within and between groups. So, if you have multiple FrameBoxes from using grouping variables then, as you say, the x and y axes (and any reference lines associated with these) will always be common. So I believe the answer is 'no', not without resorting to JSL.

hogi
Level XIII

Re: Graph Builder: reference line, different for each Y group

Fortunately, it's less JSL than one might expect:

hogi_2-1701090375582.png

 

right click / customize / + / type:

hogi_1-1701090294672.png

hogi
Level XIII

Re: Graph Builder: reference line, different for each Y group

and here an option with no JSL:
use a  "bar" graph  (with "float" style) with Response axis = X

hogi_1-1769199507139.png

 

hogi_0-1769199475772.png

 

View more...
"no JSL" - but here it is:

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// via right click - new formula column
New Column( "Mean[height][sex]",	Formula( Col Mean( :height, :sex ) )); 


Graph Builder(
	Variables(
		X( :height ),
		X( :"Mean[height][sex]"n, Position( 1 ) ),
		Y( :weight ),
		Group Y( :sex ),
		Color( :sex )
	),
	Elements(
		Points( X( 1 ), Y),
		Smoother( X( 1 ), Y ),
		Bar( X( 2 ), Bar Style( "Float" ), Response Axis( "X" ) )
	)
);
 
anne_sa
Level VI

Re: Graph Builder: reference line, different for each Y group

Hi @hogi ,
That's a very nice way to answer the problem, thanks! But if I understand correctly, it works only if we want to highlight a summary statistic value (mean, median...) and not a user defined threshold?

hogi
Level XIII

Re: Graph Builder: reference line, different for each Y group

The basic step is 

Bar Style( "Float" )

 

It can also be used for user defined thresholds. Jus store it in a column and plot it as Bar chart with Bar Style("Float")

anne_sa
Level VI

Re: Graph Builder: reference line, different for each Y group

Clear, thanks for your help @hogi !

Recommended Articles