cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
EricTsai
Level III

How to add multiple reference lines to Y-axis in graph builder?

Hi All,

I came across some problems while using graph builder ,  I need to add different refrence lines to the Y-axis (like the attahced plot), which is catogorized into 4 groups.

but the defaut setting is that all groups apply to the same reference lines, could any one help to sovle this? 

 

thanks in advance. 

 

 

ęœŖ命名.png

2 ACCEPTED SOLUTIONS

Accepted Solutions
AndresGlez
Level III

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

Hi, I found this script previously in the community and save it becuse I need to create charts with different reference lines per group, hope this is also what you need.

 

NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Different values for each group takes more work
gb2 = dt << Graph Builder(
Size( 534, 488 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :weight ), Y( :height ), Group X( :sex ) ),
Elements( Points( X, Y, Legend( 8 ) ), Smoother( X, Y, Legend( 9 ) ) )
);
gb2Rep = Report(gb2);
// Females . . .
gb2Rep[Framebox(1)] << addGraphicsScript(
PenColor("Orange"); HLine(60);
Transparency(0.25);
FillColor("Green");
Rect(50, 60, 180, 55, 1);
FillColor("Blue");
Rect(50, 65, 180, 60, 1);
);
// Males . . .
gb2Rep[Framebox(2)] << addGraphicsScript(
PenColor("Orange"); HLine(65);
Transparency(0.25);
FillColor("Green");
Rect(50, 65, 180, 60, 1);
FillColor("Blue");
Rect(50, 70, 180, 65, 1);
);

 

View solution in original post

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

This suggestion involves scripting but it is minimal.

 

  1. Right-click in one of the plots and select Customize.
  2. Click Add (plus sign).
  3. Type H Line( Y ), where the Y argument is the value for the reference line.
  4. Click OK

 

Repeat this process for each plot that requires a unique reference line.

 

Note that if you save a script now, it should include the customizations that you made.

 

Note that you can precede the graphic function with others to first determine attributes like color and line style.

View solution in original post

12 REPLIES 12

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

Did you try it interactively and save the script?

EricTsai
Level III

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

Sorry, i dont know how to use JSL to add reference lines..

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

I did not say to use a script. I said interactively. Try right-clicking on one of these axes and select Axis Settings. Add the reference lines you want and click OK. If it only adds it to one of them, the right-click and select Edit > Copy Axis Settings. Hold the Control key, right-click on another axis, and select Edit > Paste Axis Settings.

 

Does either way work?

EricTsai
Level III

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

Yeah it works, But what i need is to add different ref. lines for each group,respectively. thanks !!
AndresGlez
Level III

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

Hi, I found this script previously in the community and save it becuse I need to create charts with different reference lines per group, hope this is also what you need.

 

NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Different values for each group takes more work
gb2 = dt << Graph Builder(
Size( 534, 488 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :weight ), Y( :height ), Group X( :sex ) ),
Elements( Points( X, Y, Legend( 8 ) ), Smoother( X, Y, Legend( 9 ) ) )
);
gb2Rep = Report(gb2);
// Females . . .
gb2Rep[Framebox(1)] << addGraphicsScript(
PenColor("Orange"); HLine(60);
Transparency(0.25);
FillColor("Green");
Rect(50, 60, 180, 55, 1);
FillColor("Blue");
Rect(50, 65, 180, 60, 1);
);
// Males . . .
gb2Rep[Framebox(2)] << addGraphicsScript(
PenColor("Orange"); HLine(65);
Transparency(0.25);
FillColor("Green");
Rect(50, 65, 180, 60, 1);
FillColor("Blue");
Rect(50, 70, 180, 65, 1);
);

 

EricTsai
Level III

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

thanks a lot , it helps~

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

This suggestion involves scripting but it is minimal.

 

  1. Right-click in one of the plots and select Customize.
  2. Click Add (plus sign).
  3. Type H Line( Y ), where the Y argument is the value for the reference line.
  4. Click OK

 

Repeat this process for each plot that requires a unique reference line.

 

Note that if you save a script now, it should include the customizations that you made.

 

Note that you can precede the graphic function with others to first determine attributes like color and line style.

EricTsai
Level III

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

GOT IT~ THANKS A LOT
Mark_W
Level II

Re: How to add multiple reference lines to each group on left Y-axis in graph builder?

This script is what I am looking for, but it assumes that the data in Framebox(1) is for the Female group. How could I test this to make sure that I was the lines to the correct Framebox?