Subscribe Bookmark RSS Feed

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

drblove

Community Trekker

Joined:

Nov 2, 2016

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

Joined:

Jun 22, 2012

Solution

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
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

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

Community Trekker

Joined:

Nov 2, 2016

Thanks Jim this did the trick!