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
dhurw
Level I

Scripting Graphs without Graph builder

Good Morning Everyone!  I have been trying to create graphs without the help of graph builder since there is the red drop down button that appears in the window.  This is something I have been tasked to find and have had a big issue in finding the solution.  Basically, I am creating multiple bivariate graphs without the additional graphics such as drop down graphics. Could anyone help in pointing me to an example?

Daryl Hurwitz
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Scripting Graphs without Graph builder

Here are a couple of ways you can get what you want.  The first one can use any of the JMP platform graphics and just strip off the graphical portion and paste it into a new window.  The second example creates a new graph from scratch, using the JSL graphics primatives

prim.PNG

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

// Create a Graph Builder that does not have a red triangle
gb = dt << Graph Builder(
	invisible,
	Size( 528, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 6 ) ) )
);
nw = New Window( "Graphs", <<journal, ob = Outline Box("My Graph") );
ob << append( Report( gb )[Picture Box( 1 )] );
Report( gb ) << delete window;

// Create a graph using the JSL graphic primatives
New Window( "Example",
	Graph Box(
		Y Scale( 50, 75 ),
		X Scale( 50, 180 ),
		Marker(
			Marker State( 0 ),
			dt:weight << get values,
			dt:height << get values
		);
	)
);

Jim

View solution in original post

2 REPLIES 2
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Scripting Graphs without Graph builder

You might consider using graph builder to build your charts and then just copying the content to another box.  Here is an example which both uses graph builder and the Graph Box function to construct graphs in a new window without the red triangle.

 

names default to here(1);

dt = Open( "$Sample_data/Big class.jmp" );

//Make graphs using graph builder
gb1 = Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 2 ) ), Smoother( X, Y, Legend( 3 ) ) )
);

//then use the graphs boxes in other windows:
win = New Window( "Plot examples",
	graphbuilder = (gb1 << XPath("//GraphBuilderBox"))[1],
	graphbox = Graph Box(
		Frame Size( 300, 300 ),
		Marker( Marker State( 3 ), :height << get values, :weight << get values );
	)
);

//close graph builder
wait(0);
gb1 << close window;

//set axis limits for manually created graph:
(graphbox << XPath("//ScaleBox"))[1] << {Min(50), Max(70)};
(graphbox << XPath("//ScaleBox"))[2] << {Min(40), Max(180)};

 Output:

 

ih_0-1609177785673.png

 

txnelson
Super User

Re: Scripting Graphs without Graph builder

Here are a couple of ways you can get what you want.  The first one can use any of the JMP platform graphics and just strip off the graphical portion and paste it into a new window.  The second example creates a new graph from scratch, using the JSL graphics primatives

prim.PNG

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

// Create a Graph Builder that does not have a red triangle
gb = dt << Graph Builder(
	invisible,
	Size( 528, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 6 ) ) )
);
nw = New Window( "Graphs", <<journal, ob = Outline Box("My Graph") );
ob << append( Report( gb )[Picture Box( 1 )] );
Report( gb ) << delete window;

// Create a graph using the JSL graphic primatives
New Window( "Example",
	Graph Box(
		Y Scale( 50, 75 ),
		X Scale( 50, 180 ),
		Marker(
			Marker State( 0 ),
			dt:weight << get values,
			dt:height << get values
		);
	)
);

Jim