cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
itzikd
Level II

JSL create lines on graphs

Hello,

so I'm trying to create red lines that will be like in this script

Names Default To Here( 1 );

dt = Current Data Table();

listX = {"1"};
listY = {"test1", "test2", "test3"};
lowLine = 3;
highLine = 5;
		
bivExpr = Expr(
	Bivariate(
		Y( Eval List( listY ) ),
		X( Eval List( listx ) ),
		Fit Spline( 1, Standardized, {Line Color( "Blue" )} ),
		SendToReport(
			Dispatch(
				{},
				"Bivar Plot",
				FrameBox,
				{Add Graphics Script(
					2,
					Description( "Script" ),
					Pen Color( "Red" );
					Line Style( "dashed" );
					X Function( lowLine, x );
					X Function( highLine, x );
				), Grid Line Order( 1 ), Reference Line Order( 3 )}
			)
		)
	)
);

bivExpr;

and my table DT is like this:

 

Grouptest1test2test311
BL11111
BL222265
BL233611
POR22222
Value111134
POR57222
Value175173
Value222222
Value081116

 

result:

itzikd_0-1621788120998.png

 

my question is how can I create different lines for each graph (for the first one 3-5 for the 2nd one 2-7 and so on dynamically)

 

thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL create lines on graphs

Using Reference Lines is how I would handle this

ref.PNG

Names Default To Here( 1 );

dt = Current Data Table();

listX = {"1"};
listY = {"test1", "test2", "test3"};

lowList = {3, 2, 1};
highList = {5, 7, 9};

lowLine = 3;
highLine = 5;
		
bivExpr = Expr(
	biv = Bivariate(
		Y( Eval List( listY ) ),
		X( Eval List( listx ) ),
		Fit Spline( 1, Standardized, {Line Color( "Blue" )} )
	);
	For( i = 1, i <= N Items( listY ), i++,
		Report( biv[i] )[AxisBox( 2 )] << add Ref Line( lowList[i], "Dashed", "Red" );
		Report( biv[i] )[AxisBox( 2 )] << add Ref Line( highList[i], "Dashed", "Red" );
	);
);

bivExpr;
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: JSL create lines on graphs

Using Reference Lines is how I would handle this

ref.PNG

Names Default To Here( 1 );

dt = Current Data Table();

listX = {"1"};
listY = {"test1", "test2", "test3"};

lowList = {3, 2, 1};
highList = {5, 7, 9};

lowLine = 3;
highLine = 5;
		
bivExpr = Expr(
	biv = Bivariate(
		Y( Eval List( listY ) ),
		X( Eval List( listx ) ),
		Fit Spline( 1, Standardized, {Line Color( "Blue" )} )
	);
	For( i = 1, i <= N Items( listY ), i++,
		Report( biv[i] )[AxisBox( 2 )] << add Ref Line( lowList[i], "Dashed", "Red" );
		Report( biv[i] )[AxisBox( 2 )] << add Ref Line( highList[i], "Dashed", "Red" );
	);
);

bivExpr;
Jim