cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

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