cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

Send label position "opposite" to certain reference lines in an axis box using JSL

Howdy,

 

On JMP Pro 17.2.0, I am using << Add Ref Line commands in a For loop and would like the first 3 ref line labels to display on the opposite axis. I have tried notations such as,

 

rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( rUCL[i], "Solid", "Purple", "UCL=" || Char( rUCL[i] ), 1, Label Position("Opposite) );

 

rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( rUCL[i], "Solid", "Purple", "UCL=" || Char( rUCL[i] ), 1, Label Settings( {Opposite Axis( 1 )} ) );

 

but nothing I have tried works and results in errors such as "Name unresolved: Label Position in access or evaluation of 'label position'..." .

 

Is there a way to achieve this? Example of my code and what I want to do below.

 

codisanders_1-1748121232777.png

 

 

 

For( i = 1, i <= z, i++, 

	Eval(Expr(
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( rUCL[i], "Solid", "Purple", "UCL=" || Char( rUCL[i] ), 1 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( rCL[i], "Solid", "Black", "CL=" || Char( rCL[i] ), 1 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( rLCL[i], "Solid", "Purple", "LCL=" || Char( rLCL[i] ), 1 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( center[i], "Solid", "Green", "pCL=" || Char( Round( center[i], 2 ) ), 2 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( center[i] - sigma[i], "Dashed", "Blue", "-1Sig=" || Char( Round( center[i] - sigma[i], 2 ) ), 1 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( center[i] + sigma[i], "Dashed", "Blue", "+1Sig=" || Char( Round( center[i] + sigma[i], 2 ) ), 1 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( center[i] - 3*sigma[i], "Solid", "Red", "pLCL=" || Char( Round( center[i] - 3*sigma[i], 2 ) ), 2 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( center[i] + 3*sigma[i], "Solid", "Red", "pUCL=" || Char( Round( center[i] + 3*sigma[i], 2 ) ), 2 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( center[i] - 4*sigma[i], "Dotted", "Dark Gray", "pLDL=" || Char( Round( center[i] - 4*sigma[i], 2 ) ), 1 );
		rpVarPlots1[i][AxisBox( 1 )] << Add Ref line( center[i] + 4*sigma[i], "Dotted", "Dark Gray", "pUDL=" || Char( Round( center[i] + 4*sigma[i], 2 ) ), 1 );
)));
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Send label position "opposite" to certain reference lines in an axis box using JSL

You might have to add one extra parameter when using Label Settings (second 1 in my example and it is for transparency). This does work for me but I'm using JMP18.

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);

ab = Report(gb)[AxisBox(2)];

For(i = 1, i <= 3, i++,
	ab << Add Ref Line(
		50 + i * 5,
		"Solid",
		"Black",
		"my label",
		1,
		1,
		Label Settings({Label Position("Outside"), Opposite Axis(1)})
	)
);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Send label position "opposite" to certain reference lines in an axis box using JSL

You might have to add one extra parameter when using Label Settings (second 1 in my example and it is for transparency). This does work for me but I'm using JMP18.

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);

ab = Report(gb)[AxisBox(2)];

For(i = 1, i <= 3, i++,
	ab << Add Ref Line(
		50 + i * 5,
		"Solid",
		"Black",
		"my label",
		1,
		1,
		Label Settings({Label Position("Outside"), Opposite Axis(1)})
	)
);
-Jarmo
codisanders
Level I

Re: Send label position "opposite" to certain reference lines in an axis box using JSL

Thanks Jarmo,

 

You are correct. My script wasn't working because I did not have the <transparency> value in the command, (facepalm). Once I added that, it works as expected.

 

Thanks for the help!

 

-Codi

Recommended Articles