cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Herrera5238
Level III

Set Frame Size for multiple charts

My current script gives me multiple charts by the different product's. Which is what I'm looking for.

Now I'd like to make all those charts have the same frame size. I'm finding that I have to be specific when I use dispatch and have to write every single outline name.

The issue with that is that there will be different products every time I run it and I'd prefer not to have to go in and change the names every time.

 

Is there a way to automate this.

Data Table( "Data for Comparison" ) << Variability Chart(
	Y( Column( "Mean(Bin_VALUE)" ) ),
	X( :Bin_Size, :Status_Type2 ),
	By( :Product ),
	Show Box Plots( 1 ),
	Std Dev Chart( 0 ),
	SendToReport(
		Dispatch(
			{"Variability Gauge Product= Product 1", "Variability Chart for Mean(Bin_VALUE)"},
			"Variability Chart",
			FrameBox,
			{Frame Size( 800, 240 )}
		), 

	)
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Set Frame Size for multiple charts

You can use XPath to retrieve all of the FrameBox() objects, and then set the Frame Size to all of them

vc = Data Table( "Data for Comparison" ) << Variability Chart(
	Y( Column( "Mean(Bin_VALUE)" ) ),
	X( :Bin_Size, :Status_Type2 ),
	By( :Product ),
	Show Box Plots( 1 ),
	Std Dev Chart( 0 ),
);

(Report(vc) << xpath("//FrameBox")) << Frame Size( 800, 240 );
Jim

View solution in original post

7 REPLIES 7
txnelson
Super User

Re: Set Frame Size for multiple charts

You can use XPath to retrieve all of the FrameBox() objects, and then set the Frame Size to all of them

vc = Data Table( "Data for Comparison" ) << Variability Chart(
	Y( Column( "Mean(Bin_VALUE)" ) ),
	X( :Bin_Size, :Status_Type2 ),
	By( :Product ),
	Show Box Plots( 1 ),
	Std Dev Chart( 0 ),
);

(Report(vc) << xpath("//FrameBox")) << Frame Size( 800, 240 );
Jim
Herrera5238
Level III

Re: Set Frame Size for multiple charts

Jim,

 

This worked.

 

Could I use the same concept in the scenario below, in order to set the titles. Withouth having to type each one of them.

So go from this 

Template_TM = Expr(
	TM = Oneway(
		Y( Eval( TargetParameter )),
		X( :Process ),
		Each Pair( 1 ),
		Means and Std Dev( 1 ),
		t Test( 1 ),
		Points Jittered( 1 ),
		Box Plots( 1 ),
		Mean Error Bars( 1 ),
		Std Dev Lines( 1 ),
		Comparison Circles( 1 ),
		X Axis Proportional( 0),
		Histograms( 0),
		//Where( :PARAMETER_ID == Eval( TargetParameter )),
		SendToReport(
			Dispatch( {}, "Oneway Analysis of 0.12 By Process", OutlineBox(1), {Set Title( TargetProduct ||"_Oneway Analysis at_" || TargetParameter )} ),
			Dispatch( {}, "Oneway Analysis of 0.16 By Process", OutlineBox(1), {Set Title( TargetProduct ||"_Oneway Analysis at_" || TargetParameter )} ),
			Dispatch( {}, "Oneway Analysis of 0.2 By Process", OutlineBox(1), {Set Title( TargetProduct ||"_Oneway Analysis at_" || TargetParameter )} ),
			Dispatch( {}, "Oneway Analysis of 0.3 By Process", OutlineBox(1), {Set Title( TargetProduct ||"_Oneway Analysis at_" || TargetParameter )} ),
			Dispatch( {}, "1", ScaleBox, {Min( 0 ), Minor Ticks( 1 ), Add Ref Line(Eval(Limit_UCL), "Dotted", "Dark Blue", "UCL", 1)}),
			Dispatch( {}, "Oneway Plot", FrameBox, ),
			Dispatch( {}, "Means Comparisons", OutlineBox, {Close( 1 )} )
		)
	);
);

to this?

Template_TM = Expr(
	TM = Oneway(
		Y( Eval( TargetParameter )),
		X( :Process ),
		Each Pair( 1 ),
		Means and Std Dev( 1 ),
		t Test( 1 ),
		Points Jittered( 1 ),
		Box Plots( 1 ),
		Mean Error Bars( 1 ),
		Std Dev Lines( 1 ),
		Comparison Circles( 1 ),
		X Axis Proportional( 0),
		Histograms( 0),
		//Where( :PARAMETER_ID == Eval( TargetParameter )),
		SendToReport(
			Dispatch( {}, "1", ScaleBox, {Min( 0 ), Minor Ticks( 1 ), Add Ref Line(Eval(Limit_UCL), "Dotted", "Dark Blue", "UCL", 1)}),
			Dispatch( {}, "Oneway Plot", FrameBox, ),
			Dispatch( {}, "Means Comparisons", OutlineBox, {Close( 1 )} )
		)
	);
);
(TM<<xpath("//OutlineBox"))<<Set Title( TargetProduct ||"_Oneway Analysis at_" || TargetParameter );
EndersGame
Level I

Re: Set Frame Size for multiple charts

Hi txnelson,

 

Thanks for this solution! How can I use this for applying the same DispatchSeg() commands to all my plots? My script right now has the following code for ALL my 12+ plots:

Dispatch(
			{"Variability Gauge Analysis for Plot1",
			"Variability Chart for Plot1"},
			"Variability Chart",
			FrameBox,
			{Frame Size( 400, 200 ),
			DispatchSeg( Box Plot Seg( 1 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 2 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 3 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 4 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 5 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 6 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 7 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 8 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 9 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 10 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 11 ), Line Color( "Black" ) ),
			DispatchSeg( Box Plot Seg( 12 ), Line Color( "Black" ) )
			}
		)

I tried this, but it didn't work:

fb = {Frame Size( 400, 200 ),
	DispatchSeg( Box Plot Seg( 1 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 2 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 3 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 4 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 5 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 6 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 7 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 8 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 9 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 10 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 11 ), Line Color( "Black" ) ),
	DispatchSeg( Box Plot Seg( 12 ), Line Color( "Black" ) )
};
(Report(vc) << xpath("//FrameBox")) << fb;

Thanks in advance! 

hogi
Level XII

Re: Set Frame Size for multiple charts

from:
https://community.jmp.com/t5/Discussions/Change-the-default-color-of-box-plot-lines/m-p/762414/highl... 

 

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
	
myPlot = Variability Chart(
	Y( :height ),
	X( :age ),
	Variability Analysis( :height, Show Box Plots( 1 ) )
);

mySegs=report(myPlot)[FrameBox(1)]<< find segs; // get all display elements
Filter Each({seg},(mySegs), (seg<< class name)=="BoxPlotSeg") //just keep the Box Plots
 << Set Line Color("Black") 

 

Re: Set Frame Size for multiple charts

The fact is, we are not meant to use the Send To Report directive. This way is intended only so that JMP can capture report layer customizations when you save a script. Try the recommended way:

platform = Data Table( "Data for Comparison" ) << Variability Chart(
	Y( Column( "Mean(Bin_VALUE)" ) ),
	X( :Bin_Size, :Status_Type2 ),
	By( :Product ),
	Show Box Plots( 1 ),
	Std Dev Chart( 0 )
);

Report( platform )[FrameBox(1)] << Frame Size( 800, 240 );

Easy, eh?

 

Herrera5238
Level III

Re: Set Frame Size for multiple charts

Mark,

 

I tried this but none of the charts changed size. It did not work. 

I'm very new to JMP scipting so I'm sorry if this obeservation isn't helpful but one thing that I noticed when I pasted your script is that platform didn't turn blue.

Not sure if there is something else I'm missing.

Re: Set Frame Size for multiple charts

My solution is essentially the same as Jim's answer. I saved a reference to the plotting platform and then used it with subscripting to send the message. Jim used XPath to return the reference before sending the message. You would have to store the reference when you open each platform in a list and then send the message to the list if you want to use my approach. For example:

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

platform = List();

p = dt << Bivariate(
	Y( :weight ),
	X( :height ),
);

Insert Into( platform, Report( p )[FrameBox(1)] );

p = dt << Oneway(
	Y( :weight ),
	X( :age ),
);

Insert Into( platform, Report( p )[FrameBox(1)] );

platform << Frame Size( 800, 240 );

 

Jim's solution is more elegant.

There is no mention above about selecting display boxes so they are highlighted in blue. That result is accomplished with the << Select message.