Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- How to add reference lines automatically to variability charts?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 7, 2015 1:06 PM
(15442 views)

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.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

11 REPLIES 11

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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);
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Feb 17, 2017 6:45 AM
(13869 views)
| Posted in reply to message from mikedriscoll 10/07/2015 05:12 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Aug 10, 2017 2:33 PM
(11370 views)
| Posted in reply to message from mikedriscoll 10/07/2015 05:12 PM

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!!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Oct 8, 2015 3:26 PM
(14555 views)
| Posted in reply to message from mikedriscoll 10/08/2015 01:37 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.