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
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