cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
fg6mrw
Level II

How to add reference lines automatically to variability charts?

I need to make many graphs such as the one below and add limits using the reference limits in the axis settings. The limits are different for each graph. Is there a way to automate this so I do not have to manually add to each graph? The upper and lower limits could be included in the data set in extra columns.

10155_pastedImage_0.png

1 ACCEPTED SOLUTION

Accepted Solutions
jara95
Level III

Re: How to add reference lines automatically to variability charts?

Here is the thread about adding ref. line. There is a check box "Show as graph reference lines" at the bottom of the spec limit box if you use JMP 10 or greater.

JSL - showing spec limits as graph reference lines

View solution in original post

11 REPLIES 11
mikedriscoll
Level VI

Re: How to add reference lines automatically to variability charts?

You can get your limits into a list, then use a variation of code snippet here to add reference lines. Note that there are two ways to do it via script that I know of. One is to set the column property (limit of 4 lines, stays with table and resulting plots), one is to the output, no limitation i know of, but does not get store to table for later use.

 

You can copy / paste to a script window and run it. Of course you'd need to loop through the parameters to fully automate to your needs.

 

Clear Log();
Names Default To Here( 1 );
 
 
dtData = open( "$SAMPLE_DATA\Variability Data\2 Factors Crossed.jmp");
 
 
// 1. add ref lines to the column property.  It will be there for other plots as well.
// this first attempt doesn't work...
//column(dtData, "Measurement")<<set property("Axis", {add reference line(0.4), add reference line(1.2)});
 
// ... but this does.  However, this column property appears to have a limit of four reference lines.
myAxis=expr(:Measurement<<set property("Axis", {Add Ref Line(aaa),Add Ref Line(bbb)}));
eval(substitute(nameexpr(myAxis), expr(aaa), 0.4, expr(bbb), 1.2));
 
      //:mass << set property("Spec Limits", {65, 125});
 
 
// create the chart, store a referecne to it.
      varChartObj = Variability Chart(
            Y( :Measurement),
            X( {:Operator, :part#} ),
            Max Iter( 100 ),
            Conv Limit( 0.00000001 ),
            Number Integration Abscissas( 128 ),
            Number Function Evals( 65536 ),
            Analysis Type( Name( "Choose best analysis (EMS REML Bayesian)" ) ),
            Show Range Bars( 0 ),
            Connect Cell Means( 1 ),
            Std Dev Chart( 0 ),
            Points Jittered( 1 ),
            Show Box Plot Whisker Bars( 0 )
      );
 
// 2. The second way to do it is to add the reference lines after creating the plot. I don't know if there is a limit. I've used up to 10.
      report(varChartObj)[axisbox(1)]<< add ref line (0.3, solid, red);
      report(varChartObj)[axisbox(1)]<< add ref line (1.3, solid, red);
     
      // without these, the ref lines would be out of view. You could also get the min  / max of the window, and set the new min / max of the window based off min min and max max.  I typically make the window's scale about 10% bigger than the min / max points of interest.
      report(varChartObj)[axisbox(1)]<<  min(0.2);
      report(varChartObj)[axisbox(1)]<<  max(1.4);

 

b0bajmp
Level I

Re: How to add reference lines automatically to variability charts?

Thank you for this.

Especially the part below:

 

eval(substitute(nameexpr(myAxis), expr(aaa), 0.4, expr(bbb), 1.2));

For some reason this substitution is necessary in jmp 12 but not jmp 11 if variables are used instead of the numbers.

I don't know why this is but I am glad I found this structure in your post.

Eduardo
Level III

Re: How to add reference lines automatically to variability charts?

Thanks for this feedback. I used it in the following way since I needed to set many reference lines.

VarChartObj=Graph builder(..)
M=[1,20,30,....];//many as 20 different values
For (i=1,i<=size matrix M, i++,
report(varChartObj)[axisbox(1)]<< add ref line (M[i], solid, red);
);

I noticed that execution is very slow although is only about 20 ref lines. I was wondering if there is a way to pass the Matrix argument to the line below without having to make a For loop (I thought perhaps the problem is the loop). Something like:

report(varChartObj)[axisbox(1)]<< add ref line (Matrix, solid, red);

or any other method...thanks in advance for your help!!

jara95
Level III

Re: How to add reference lines automatically to variability charts?

Or you can use the column property "Spec Limits".

 

:Column 1<<set property("Spec Limits",{LSL( 7 ), USL( 30 ), Target( . ),    Show Limits( 1 )});

After you set the LSL and USL for a given column, all charts will show the reference lines.

fg6mrw
Level II

Re: How to add reference lines automatically to variability charts?

I added the spec limits to the column properties per below but the charts are not showing the reference lines when I re-plot. Am I doing something wrong?

10162_pastedImage_0.png

10172_pastedImage_1.png

jara95
Level III

Re: How to add reference lines automatically to variability charts?

Here is the thread about adding ref. line. There is a check box "Show as graph reference lines" at the bottom of the spec limit box if you use JMP 10 or greater.

JSL - showing spec limits as graph reference lines

mikedriscoll
Level VI

Re: How to add reference lines automatically to variability charts?

For my version of JMP (11 standard) it has a checkbox to show reference lines at the spec limits.  If it is not checked, distribution platform will show limit lines but the variability platform won't. If it is checked then variability gauge platform will show the limits reference lines.

You might be on some other version of JMP in which case you might also want to add reference lines to the column properties in addition to the limits.

fg6mrw
Level II

Re: How to add reference lines automatically to variability charts?

I have an older revision (8) and it does not have that checkbox. I noticed that it adds the limits to the distribution but not to the variability. I will see about getting an upgrade to a recent version.

Kevin_Anderson
Level VI

Re: How to add reference lines automatically to variability charts?

"There are a million ways to get things done..." Talking Heads

I'll answer your question with some questions of my own:

     Is this something you will do once, or many times over and over?

     If many, do the limits change over time?

     If many, will you alone run the script, or will others?

Depending on the answers to these, I might seriously consider using an iterative loop with Associative Arrays from a look-up table.