For the latest version of JMP Help, visit JMP.com/help.


Publication date: 11/10/2021

Customize Graphs

You can also make changes to graphs in a script. For example, create a window with a graph, get a reference to the report, and then set the frame box size.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate( Y( :weight ), X( :height ), Fit Line );
rbiv = biv << Report;
rbiv[Frame Box( 1 )] << Frame Size( 400, 400 );

To see a list of possible messages for any given display box object, select Help > Scripting Index and select Display Boxes from the list. Running the Show Properties() command is an alternative to using the Scripting Index. For example, here is a partial list of messages that you can send to an axis:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate( Y( :weight ), X( :height ), Fit Line );
rbiv = biv << Report;
Show Properties( rbiv[Axis Box( 1 )] );

Axis Settings [Action](Provides a way to bring up the axis dialog or set configurable axis options for a given axis.)

Revert Axis [Action](Restore the settings that this axis had originally.)

Add Axis Label [Action]

Remove Axis Label [Action]

...

The following expressions change the font of both axis labels (weight and height in the example above) to 12-point, italic Arial Black:

rbiv[Text Edit Box( 1 )] << Set Font( "Arial Black", 12, Italic );
rbiv[Text Edit Box( 2 )] << Set Font( "Arial Black", 12, Italic );

or

rbiv[Text Edit Box( 1 )] << Set Font( "Arial Black" );
rbiv[Text Edit Box( 1 )] << Set Font Style( "Italic" );
rbiv[Text Edit Box( 1 )] << Set Font Size( 12 );
rbiv[Text Edit Box( 1 )] << Set Font( "Arial Black" );
rbiv[Text Edit Box( 2 )] << Set Font Style( "Italic" );
rbiv[Text Edit Box( 2 )] << Set Font Size( 12 );
rbiv[Text Edit Box( 2 )] << Set Font Name( "Arial Black" ) << Set Font Size( 12 ) << Set Font Style( Italic )

The default font specified in the Preferences is applied if the font is not installed on the computer.

Specifying a Missing Color Value

When you specify a color theme in a script, you can specify the color of a missing value. Use the Missing argument. In this example, the missing color is yellow. Refer to an online RGB value table for the color values.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Graph Builder(
	Size( 528, 450 ),
	Show Control Panel( 0 ),
	Variables(
		X( :height ),
		Y( :weight ),
		Color( Transform Column( "wc", Formula( Root( :weight - 80 ) ) ) )
	),
	Elements( Points( X, Y, Legend( 8 ) ) ),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model( 8,
				Properties( 0, {gradient(
					{Color Theme(
						{"Blue to Gray to Red Copy", 4099, {{42, 63, 255}, {192,
						192, 192}, {252, 11, 11}, Missing( {255, 211, 0} )}}
					)}
				)},
				Item ID( "wc", 1 )
				)
			)}
		)
	)
);
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).