cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
rahulsmils
Level III

Format multiple life distribution plots

Hi all I am trying to format axis scales and apply targets to 4 life distribution plots which JMP shows as output of this code.

myld references to a window which has 4 Life distributions.

I am trying to loop through those 4 life distributions through searching in the title is the window has life distribution.

Then I want to change x and y axis for each of those Weibull plots.

Somehow the code only changes 1st plot and remaining 3 are not changed, likely I am not able to grap the handle for rest of the plots correctly.

 

Can someone help correct this code to achieve what I am trying to do.

Better if the "Add Ref Line(2 "  can be turned into a variable so I can supply 2 as an argument.

So I can add a different reference line for all 4 plots inside for loop. These values can be stores in a list before running the loop.

 

Thank You

 

 

 

 

myld = Life Distribution(
	Perspective( Compare Groups ),
	Y( :Voltage ),
	Grouping( :flavor ),
	By( :A, :B, :C, :D),
	Confidence Interval Method( Likelihood ),
	Select Distribution( Distribution, Weibull ),
	Select Scale( Weibull ),
	Tabbed Report( 0 ),
	Show Confidence Area( 0 )

);


report_windows = Get Window List( "myld" );//; << Get Window Title
report_of_interest = Empty();
For Each( {report_window}, report_windows,
	outline_title = Try( report_window[Outline Box( 1 )] << get title, "" );
	
	If( Starts With( outline_title, "Life Distribution" ),
		print(outline_title);
		report_of_interest = report_window;

		ref = report_window[Outline Box( 1 )] << Get Scriptable Object;
		xaxis = Report( ref )[axis box( 2 )];

		xaxis << Axis Settings(
			Format( "Precision", 6, 2 ),
			Min( 1 ),
			Max( 5 ),
			Inc( 0.01 ),
			Minor Ticks( 1 ),
			Add Ref Line(2, "Dotted", "Black", "", 2 ),
			Label Row( {Major Grid Line Color( "Light Yellow" ), Show Major Grid( 1 )} )
		);
		
		yaxis = Report( ref )[axis box( 1 )];
		yaxis << Axis Settings(
			Min( 0 ),
			Max( 1 ),
			Inc( 0.1 ),
			Minor Ticks( 0 ),
			Add Ref Line(0.5, "Dotted", "Black", "", 2 )
		);

		
	);
);
3 REPLIES 3
hogi
Level XII

Re: Format multiple life distribution plots

 List of all Platform objects? 

there are many objects with helper key "Life Distribution" - just take the top one.

And from there it's the first FrameBox.

OBs = (Current Report() << xpath( "//OutlineBox[@helpKey and not(ancestor::OutlineBox[@helpKey])]" )) 
For Each({OB}, OBs, 
	xaxis = OB[axis box( 2 )];

		xaxis << Axis Settings(
			Format( "Precision", 6, 2 ),
			Min( 1 ),
			Max( 5 ),
			Inc( 0.01 ),
			Minor Ticks( 1 ),
			Add Ref Line(2, "Dotted", "Black", "", 2 ),
			Label Row( {Major Grid Line Color( "Light Yellow" ), Show Major Grid( 1 )} )
		);
		
		yaxis = OB[axis box( 1 )];
		yaxis << Axis Settings(
			Min( 0 ),
			Max( 1 ),
			Inc( 0.1 ),
			Minor Ticks( 0 ),
			Add Ref Line(0.5, "Dotted", "Black", "", 2 )
		);
	
);
jthi
Super User

Re: Format multiple life distribution plots

Depending on the JMP version you have different options (I go with the assumption of JMP18). When you use By column in your platform, you can get back a list of platforms which you can then loop over (you can get the list also by using XPath). Usually I try to find some very robust OutlineBox and then use that to "tie" the indices. 

 

This isn't exactly the same what you are doing but should give some ideas about what can be done.

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/Fan.jmp");
dt << New Column("Group", Nominal, Numeric, Formula(Row() <= 35));

lds = dt << Life Distribution(Y(:Time), Censor(:Censor), By(:Group));

refs = Associative Array();
refs["0"] = 0.2;
refs["1"] = 0.4;

// show(lds);

For Each({ld}, lds,
	rep = Report(ld);
	grouptitle = rep << get title;
	// show(rep << get title);
	groupname = Word(-1, grouptitle, "=");

	// Be careful with axis indices as there can be "hidden" axis
	yaxis = rep[Outline Box("Compare Distributions"), AxisBox(1)];
	xaxis = rep[Outline Box("Compare Distributions"), AxisBox(2)];
	
	
	// Two methods shown here
	xaxis << Min(1000) << Max(12000) << Inc(1000) << Format("Precision", 6, 2) << Minor Ticks(1) << Label Row(
		{Major Grid Line Color("Light Yellow"), Show Major Grid(1)}
	);
	
	yaxis << Axis Settings(
		Format("Precision", 6, 2),
		Min(0),
		Max(1),
		Inc(0.1),
		Minor Ticks(1),
		Add Ref Line(refs[groupname], "Dotted", "Black", "", 2)
	);
);

jthi_1-1731565898938.png

 

-Jarmo

Re: Format multiple life distribution plots

Thank you, I appreciate it.