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
- :
- How to add reference lines automatically to variab...

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

Highlighted
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.

- 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
(10166 views)

1 ACCEPTED SOLUTION

Accepted Solutions

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

Oct 8, 2015 10:37 AM
(18244 views)

Solution

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

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

Oct 7, 2015 2:12 PM
(9279 views)

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

Feb 17, 2017 6:45 AM
(8593 views)

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

Aug 10, 2017 2:33 PM
(6094 views)

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

Oct 8, 2015 6:43 AM
(9279 views)

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

Oct 8, 2015 10:10 AM
(9279 views)

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

Oct 8, 2015 10:37 AM
(18245 views)

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

Oct 8, 2015 10:37 AM
(9279 views)

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

Oct 8, 2015 3:26 PM
(9279 views)

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

Oct 8, 2015 9:19 AM
(9279 views)

"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.