cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

Remove and add wrap variables in graph builder with JSL

When I manually add a line in graph builder via the costume graph script function in the window and then wrap or group it with a nominal variable, the stacked windows will have the same costume line copied.

 

Right click in the graph windows --> Customize --> click on the “+” button (add the “Script” entry) and add the line script (for example with the Samples --> “Drag Line” option).

 

But if I then save the script to the data table, every windows has now an entry to add the costume graph and can become very long. I would need to program a complicated for loop to add the graph code to each window.

 

I want to make the same steps in JSL as by hand:

- create graph

- set costume line

- add the wrap column

 

 

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS
1 ACCEPTED SOLUTION

Accepted Solutions
Mauro_Gerber
Level V

Re: Remove and add wrap variables in graph builder with JSL

Code snippet to add and remove a wrap variable. This came from the online discovery summit 2021 unsession JSL scripting.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

//make initial graph
gb = Graph Builder(
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y ), Smoother( X, Y ) )
);

//get a reference to the grab builder box
gbb = Report( gb )[Graph Builder Box( 1 )];

Wait( 1 );

//add a wrap variable to demonstrate adding
gbb << Add Variable( {:age, Role( "Wrap" )} );

Wait( 1 );

//remove wrap variable
gbb << Remove Variable(  {:age, Role( "Wrap" )});

Wait( 1 );

//add graphics script
gbb[frame box( 1 )] << Add Graphics Script(
	2,
	Description( "" ),
	If( Is Empty( g_x4 ),
		g_x4 = [52.92, 68.48, 70.56];
		g_y4 = [119.69, 139.30, 124.01];
	);
	Drag Line( g_x4, g_y4 );
);

//add wrap variable			
gbb << Add Variable( {:age, Role( "Wrap" )} );

Script by  @jules THX a lot.

 

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS

View solution in original post

2 REPLIES 2

Re: Remove and add wrap variables in graph builder with JSL

The following example uses the <<Add Graphics Script() message to add the Drag Line.  

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

gb = dt << Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 2 ) ), Smoother( X, Y, Legend( 4 ) ) )
);

Report( gb )[FrameBox( 1 )] << Add Graphics Script(
	If( Is Empty( g_x1 ),
		g_x1 = [50.53, 66.28, 64.49];
		g_y1 = [102.99, 45.69, 106.10];
	);
	Drag Line( g_x1, g_y1 );
);

Report( gb )[Graph Builder Box( 1 )] << Add Variable( {:age, Role( "Wrap" )} );

I hope that helps.

Wendy
Mauro_Gerber
Level V

Re: Remove and add wrap variables in graph builder with JSL

Code snippet to add and remove a wrap variable. This came from the online discovery summit 2021 unsession JSL scripting.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

//make initial graph
gb = Graph Builder(
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y ), Smoother( X, Y ) )
);

//get a reference to the grab builder box
gbb = Report( gb )[Graph Builder Box( 1 )];

Wait( 1 );

//add a wrap variable to demonstrate adding
gbb << Add Variable( {:age, Role( "Wrap" )} );

Wait( 1 );

//remove wrap variable
gbb << Remove Variable(  {:age, Role( "Wrap" )});

Wait( 1 );

//add graphics script
gbb[frame box( 1 )] << Add Graphics Script(
	2,
	Description( "" ),
	If( Is Empty( g_x4 ),
		g_x4 = [52.92, 68.48, 70.56];
		g_y4 = [119.69, 139.30, 124.01];
	);
	Drag Line( g_x4, g_y4 );
);

//add wrap variable			
gbb << Add Variable( {:age, Role( "Wrap" )} );

Script by  @jules THX a lot.

 

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS

Recommended Articles