Subscribe Bookmark RSS Feed

Fix the graph size of analysis result by using JMP scripting

Tzu-Chun

Occasional Contributor

Joined:

Oct 25, 2017

Hi

 

I was trying to fix the size of frame box in the analysis result, the following code as an example:

 

dt = Open( "$SAMPLE_DATA/Flight Distances.jmp" );
dt << Multidimensional Scaling( Y( :Birmingham, :Boston, :Buffalo, :Chicago, :Cleveland, :Dallas, :Denver, :Detroit, :El Paso, :Houston, :Indianapolis, :Kansas City, :Los Angeles, :Louisville, :Memphis, :Miami, :Minneapolis, :New Orleans, :New York, :Omaha, :Philadelphia, :Phoenix, :Pittsburgh, :St. Louis, :Salt Lake City, :San Francisco, :Seattle, :Washington DC ), SendToReport( Dispatch( {"Multidimensional Scaling Plot"}, "MDS Report Plot", FrameBox, {Frame Size( 750, 500 )} ) ) );

 

The frame size (750, 500) is the desired setting. However, it became to the default setting after I click the "Flip Vertical" of "Flip Horizontal" button.

 

                                 before                                                                        After

image.pngimage.png

 

Is there a way to fix the size of frame box autometically using JMP scripting instead of right click the frame box and set the fram size manually?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ih

Community Trekker

Joined:

Sep 30, 2016

Solution

One way would be to set the frame size and flip the graph using JSL.  The report from 'mds << Show Tree Structure;' shows where 'FrameBox(1)' came from.

mds = dt << Multidimensional Scaling( ... );
mds << Flip Horizontal( 1 );
(mds << Find( FrameBox(1) )) << Frame Size ( 750, 500 );

 

To make this interactive you could replace the flip buttons with your own:

Names default to here( 1 );

dt = Open( "$SAMPLE_DATA/Flight Distances.jmp" );
mds = dt << Multidimensional Scaling(
    Y( 	:Birmingham, :Boston, :Buffalo, :Chicago, :Cleveland, 
		:Dallas, :Denver, :Detroit, :El Paso, :Houston, :Indianapolis, 
		:Kansas City, :Los Angeles, :Louisville, :Memphis, :Miami, 
		:Minneapolis, :New Orleans, :New York, :Omaha, :Philadelphia, 
		:Phoenix, :Pittsburgh, :St. Louis, :Salt Lake City, 
		:San Francisco, :Seattle, :Washington DC
    ),
    SendToReport(
		Dispatch(
			{"Multidimensional Scaling Plot"}, 
			"MDS Report Plot", 
			FrameBox, 
			{Frame Size( 750, 500 )} 
		)
	)
);

//Hide the default Flip buttons:
(mds << Find( Button Box(1) ) ) << visibility( "collapse" );
(mds << Find( Button Box(2) ) ) << visibility( "collapse" );

//Add new Flip buttons that set the frame size
(mds << Find( Listbox(3) )) << Append( Button Box( 
	"Flip Vertical New" , 
	mds << Flip Vertical( 1 );
	(mds << Find( FrameBox(1) )) << Frame Size ( 750, 500 )
));

(mds << Find( Listbox(3) )) << Append( Button Box( 
	"Flip Horizontal New" , 
	mds << Flip Horizontal( 1 );
	(mds << Find( FrameBox(1) )) << Frame Size ( 750, 500 )
));
2 REPLIES
ih

Community Trekker

Joined:

Sep 30, 2016

Solution

One way would be to set the frame size and flip the graph using JSL.  The report from 'mds << Show Tree Structure;' shows where 'FrameBox(1)' came from.

mds = dt << Multidimensional Scaling( ... );
mds << Flip Horizontal( 1 );
(mds << Find( FrameBox(1) )) << Frame Size ( 750, 500 );

 

To make this interactive you could replace the flip buttons with your own:

Names default to here( 1 );

dt = Open( "$SAMPLE_DATA/Flight Distances.jmp" );
mds = dt << Multidimensional Scaling(
    Y( 	:Birmingham, :Boston, :Buffalo, :Chicago, :Cleveland, 
		:Dallas, :Denver, :Detroit, :El Paso, :Houston, :Indianapolis, 
		:Kansas City, :Los Angeles, :Louisville, :Memphis, :Miami, 
		:Minneapolis, :New Orleans, :New York, :Omaha, :Philadelphia, 
		:Phoenix, :Pittsburgh, :St. Louis, :Salt Lake City, 
		:San Francisco, :Seattle, :Washington DC
    ),
    SendToReport(
		Dispatch(
			{"Multidimensional Scaling Plot"}, 
			"MDS Report Plot", 
			FrameBox, 
			{Frame Size( 750, 500 )} 
		)
	)
);

//Hide the default Flip buttons:
(mds << Find( Button Box(1) ) ) << visibility( "collapse" );
(mds << Find( Button Box(2) ) ) << visibility( "collapse" );

//Add new Flip buttons that set the frame size
(mds << Find( Listbox(3) )) << Append( Button Box( 
	"Flip Vertical New" , 
	mds << Flip Vertical( 1 );
	(mds << Find( FrameBox(1) )) << Frame Size ( 750, 500 )
));

(mds << Find( Listbox(3) )) << Append( Button Box( 
	"Flip Horizontal New" , 
	mds << Flip Horizontal( 1 );
	(mds << Find( FrameBox(1) )) << Frame Size ( 750, 500 )
));
Tzu-Chun

Occasional Contributor

Joined:

Oct 25, 2017

Thanks so much, that was exactly what I need.