cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

JSL - Adding a horizontal line (from a variable) to a plot

I am trying to add a horizonal line to a plot that I have made where the hieght of the line is a variable in the JSL (based on statitical calucations.  So for example:

 

test_here = temp << Graph Builder(
    Size( 534, 448),
    Show Control Panel(0),
    Variables( X( :Panels), Y( :Score), Color (:Code)),
    Elements( Points(X,Y,Legend(24), Jitter(0)))
);
// Want to add the line Y = upper_bound <- Just a number calculated prior to this 

I am sure this is another easy thing to do that I will add to my knowledge base soon.... Thank you in advance.

 

Brad

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL - Adding a horizontal line (from a variable) to a plot

Here is a script that does what you want:

Names Default to Here( 1 );
test_here = Graph Builder(
	Variables( X( :Column 6 ), Y( :height ), Color( :sex ) ),
	Elements( Points( X, Y, Legend( 3 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {3, [0, -1]} ), Position( {0, -1} )}
		)
	)
);
upper_bound=70;
report(test_here)[axisbox(2)] << Add Ref Line( upper_bound, "solid", black, "", 2 );
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: JSL - Adding a horizontal line (from a variable) to a plot

Here is a script that does what you want:

Names Default to Here( 1 );
test_here = Graph Builder(
	Variables( X( :Column 6 ), Y( :height ), Color( :sex ) ),
	Elements( Points( X, Y, Legend( 3 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {3, [0, -1]} ), Position( {0, -1} )}
		)
	)
);
upper_bound=70;
report(test_here)[axisbox(2)] << Add Ref Line( upper_bound, "solid", black, "", 2 );
Jim
drblove
Level III

Re: JSL - Adding a horizontal line (from a variable) to a plot

Thanks Jim this did the trick!

Recommended Articles