cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to use Accelerated Life Testing (ALT) to evaluate reliability. Register for June 5 webinar, 2pm US Eastern Time.

Discussions

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

expr and evalexpr for Graph Builder gradient limits

I am trying to set up a script that will generate a Graph Builder with gradient min and max equal to to Quantile values of the Column being plotted.

 

Unfortunately, the expr and evalexpr syntax I am using doesn't work for the matrix in "Scale Values".

 

I need help.

 

dt0 = current data table();
param = "Voltage";
colp = dt0:param;
graph_high = Quantile( 0.975, column(dt0, param) << get as matrix() );
graph_low = Quantile( 0.025, column(dt0, param) << get as matrix() );

cmd = expr(
	Graph Builder(
		Size( 550, 550 ),
		Show Control Panel( 0 ),
		Variables(
			X( :x ),
			Y( :y ),
			Color( :expr(param) )
		),
		Elements( Points( X, Y, Legend( 6 ) ) ),
		SendToReport(
			Dispatch(
				{},
				"400",
				ScaleBox,
				{Legend Model(
					6,
					Properties(
						0,
						{gradient( {Scale Values( [expr(graph_low) expr(graph_high)] )} )}, // *Need Help Here*
						Item ID( expr(param), 1 )
					)
				)}
			)
		)
	);
);

eval(evalexpr(cmd));
1 ACCEPTED SOLUTION

Accepted Solutions
ErraticAttack
Level VI

Re: expr and evalexpr for Graph Builder gradient limits

I don't have your data to validate, but this should work:

 

dt0 = current data table();
param = "Voltage";
colp = dt0:param;
graph_high = Quantile( 0.975, column(dt0, param) << get as matrix() );
graph_low = Quantile( 0.025, column(dt0, param) << get as matrix() );
val matrix = [](1,0) || graph_low || graph_high;

cmd = expr(
	Graph Builder(
		Size( 550, 550 ),
		Show Control Panel( 0 ),
		Variables(
			X( :x ),
			Y( :y ),
			Color( :expr(param) )
		),
		Elements( Points( X, Y, Legend( 6 ) ) ),
		SendToReport(
			Dispatch(
				{},
				"400",
				ScaleBox,
				{Legend Model(
					6,
					Properties(
						0,
						{gradient( {Scale Values( Expr( val matrix ) )} )}, // *Need Help Here*
						Item ID( expr(param), 1 )
					)
				)}
			)
		)
	);
);

eval(evalexpr(cmd));
Jordan

View solution in original post

2 REPLIES 2
ErraticAttack
Level VI

Re: expr and evalexpr for Graph Builder gradient limits

I don't have your data to validate, but this should work:

 

dt0 = current data table();
param = "Voltage";
colp = dt0:param;
graph_high = Quantile( 0.975, column(dt0, param) << get as matrix() );
graph_low = Quantile( 0.025, column(dt0, param) << get as matrix() );
val matrix = [](1,0) || graph_low || graph_high;

cmd = expr(
	Graph Builder(
		Size( 550, 550 ),
		Show Control Panel( 0 ),
		Variables(
			X( :x ),
			Y( :y ),
			Color( :expr(param) )
		),
		Elements( Points( X, Y, Legend( 6 ) ) ),
		SendToReport(
			Dispatch(
				{},
				"400",
				ScaleBox,
				{Legend Model(
					6,
					Properties(
						0,
						{gradient( {Scale Values( Expr( val matrix ) )} )}, // *Need Help Here*
						Item ID( expr(param), 1 )
					)
				)}
			)
		)
	);
);

eval(evalexpr(cmd));
Jordan
LaserGuy
Level II

Re: expr and evalexpr for Graph Builder gradient limits

Thanks a lot. This worked.

 

Now that you gave me the idea of creating a matrix using variables, and then putting that matrix into the Graph Builder script, I decided to play around. It looks like I don't need to use Expr() around the "val matrix".

 

I find that this works as well:

dt0 = current data table();
param = "Voltage";
colp = dt0:param;
graph_high = Quantile( 0.975, column(dt0, param) << get as matrix() );
graph_low = Quantile( 0.025, column(dt0, param) << get as matrix() );
val matrix = matrix( {graph_low, graph_high} );

cmd = expr(
	Graph Builder(
		Size( 550, 550 ),
		Show Control Panel( 0 ),
		Variables(
			X( :x ),
			Y( :y ),
			Color( :expr(param) )
		),
		Elements( Points( X, Y, Legend( 6 ) ) ),
		SendToReport(
			Dispatch(
				{},
				"400",
				ScaleBox,
				{Legend Model(
					6,
					Properties(
						0,
						{gradient( {Scale Values( val matrix )} )},
						Item ID( expr(param), 1 )
					)
				)}
			)
		)
	);
);

eval(evalexpr(cmd));

Recommended Articles