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

JSL Script for creating Multiple Plots for Y vs X by A with a Limits Table to create control charts

I have a JMP table with say 5 cols

ColA is categrical column. ColA can have different group of values. However for each group of values from ColA LCL & UCL are same I mean like this:(say)

Sample data with just 2 groups from Col A

Col A   LCL  UCL           Y      X

a           5      10             9      PQR1

a           5       10            11    PQR2

b          17       25          12     ABC1

b          17       25          14     ABC1

b          17       25           19    ABC1

 

So I want to plot Y vs X ( box plot say in this case) by Col A . So this should geneate two plots ( one for a and other for b). However I want to create a JSL script to create the two different control charts for each plot. For the case a ( 5,10) and for case b ( 17, 25).

 

I know this is simple in JMP. But in my case I am generating data on the fly and I will not know how many groups and what are the LCL/UCL. So need to have a script to accomplish that. Trying to understand how to solve this problem using JSL.

  

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
tnodd
Level II

Re: JSL Script for creating Multiple Plots for Y vs X by A with a Limits Table to create control ch

Wonderful!! Worked like a charm!!! Thanks

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: JSL Script for creating Multiple Plots for Y vs X by A with a Limits Table to create control ch

There are different Control Limits for the different charts, and they each need to be set within the column for them to take affect for the chart. Will you always be using a specific type of chart, or would you need to set the limits from your table to each of the limit types(XBar, Individual...…)? Will you be using the Control Chat Builder platform, or the Control Chart platform?
Jim
tnodd
Level II

Re: JSL Script for creating Multiple Plots for Y vs X by A with a Limits Table to create control ch

Thanks, Jim...

Well, I will always be plotting my Y vs X based on the grouped column ( in this case Col A say)...

 

I was not planning to use any platform yet. 

 

The way I was targeting the problem is to create an associative array based on the group and then create a loop. But that is not working too. I have pasted the snippet of the code below.

 

 

dt = Current Data Table();
summarize(groupid=by(:Col A));

map_l = Associative Array( :Col A, :LCL );
map_u = Associative Array( :Col A, :UCL );


for(i=1, i<= N Items(groupid), i++,

  idname = char(groupid[i]);
 
  df = dt << Oneway(
	Y( :Y ),
	X( :X ),
	Box Plots( 1 ),
	Mean Diamonds( 1 ),
	Where( :Col A == idname ),
	Add Ref Line(map_u[idname] , "Dashed", "Black", "UCL", 1 ),
	Add Ref Line(map_l[idname] , "Dashed", "Black", "LCL", 1 )
	
	
)

)

 

 

txnelson
Super User

Re: JSL Script for creating Multiple Plots for Y vs X by A with a Limits Table to create control ch

Your Add Ref Line syntax is incorrect.  It either has to be enclosed in the Oneway platform definition as a "Send to Report" structure, or added after the fact, sending an Add Ref Line message to the Reports AxisBox, as I have showned below

Names Default To Here( 1 );
dt = Current Data Table();
Summarize( groupid = by( :Col A ) );

map_l = Associative Array( :Col A, :LCL );
map_u = Associative Array( :Col A, :UCL );


For( i = 1, i <= N Items( groupid ), i++, 

	idname = Char( groupid[i] );
 
	
	df = dt << Oneway(
		Y( :Y ),
		X( :X ),
		Box Plots( 1 ),
		Mean Diamonds( 1 ),
		Where( :Col A == idname )
	);
	Report( df )[AxisBox( 1 )] <<
	Add Ref Line( map_u[idname], "Dashed", "Black", "UCL", 1 );
	Report( df )[AxisBox( 1 )] <<
	Add Ref Line( map_l[idname], "Dashed", "Black", "LCL", 1 );			
);
Jim
tnodd
Level II

Re: JSL Script for creating Multiple Plots for Y vs X by A with a Limits Table to create control ch

Wonderful!! Worked like a charm!!! Thanks