cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
mylifemyrule
Level I

Script for distribution plot ( multiple column and group by row name)

Hi All,

 

I would like to create a script for below distribution. Where should I edit in the script to have "by" grouping.

And if I just want to display lot_id=lot01 how can I filter that in the script

mylifemyrule_0-1686831450787.png

 

Appreciate if anyone can help me on this. 

 

I get this script from https://community.jmp.com/t5/Discussions/Script-multiple-columns-grouped-in-distribution-plot/m-p/16...

4 REPLIES 4
mylifemyrule
Level I

Re: Script for distribution plot ( multiple column and group by row name)

names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");

colList = dt << get column names(continuous,string);
// For this illustration I want to use just the NPNn columns
for(i=nitems(colList), i>=1,i--,
	If(substr(colList[i],1,3)!="NPN", remove from(colList,i,1))
);

// build the JSL string
theExpr = 
"Dis = Distribution(
		Continuous Distribution( Column( :" || colList[1] || " ), 
		Process Capability( Use Column Property Specs ) )";
For( i = 2, i <= N Items( colList ), i++,
	theExpr = theExpr || "," || "Continuous Distribution( Column( :" || colList[i] ||
	" ), Process Capability( Use Column Property Specs ) )"
);
theExpr=theExpr||");";

// run the built JSL string
eval(parse(theexpr));

// Standardize the settings
disr = Dis << report;

disr[colList[1]]["Quantiles"]<<close all like this;
disr[colList[1]]["Summary Statistics"]<<close all like this;
disr[colList[1]]["Process Capability"]<<close all like this;

For(i=1,i<=nitems(colList),i++,
	disr[colList[i]][AxisBox(1)] << min(87) << max(127) << inc(5)
	<< Add Ref Line( 121, "Solid","Black","",1)
	<< Add Ref Line( 100, "Solid", "Black", "", 1 )
	<< Add Ref Line( 90, "Solid", "Black", "", 1 )
);

here the script

txnelson
Super User

Re: Script for distribution plot ( multiple column and group by row name)

All you have to do is to run the Distribution platform as you want it to be, and then go to the red triangle and select 

    "Save By Group Script"

txnelson_0-1686833513285.png

and it will give you the script with the By element included.

Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( :NPN1 ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Process Capability( Use Column Property Specs )
	),
	By( :lot_id )
);
Jim
mylifemyrule
Level I

Re: Script for distribution plot ( multiple column and group by row name)

hi Jim,

 

Thanks a lot for your prompt respond. I would like to generate a script which I can reused that for other data type ( different column name). Is there any way I can automate that using script.

 

Thanks,

Maya

 

txnelson
Super User

Re: Script for distribution plot ( multiple column and group by row name)

The script that you displayed from a previous Discussion is an example of dynamically generating Distributions, by finding the column names in the data table it is pointing at, and then running those distributions.  Assuming you are familiar with programming, you should be able to follow the script.  Any of the functions used can be looked up in the Scripting Index, where a definition and usage example(s) are shown.

 

As you work to perfect your script, the Community will always be there to help you with issues you may come across.

Jim