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

- JMP User Community
- :
- Discussions
- :
- "On the fly" distribution-report and using variables

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

Highlighted
##

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

"On the fly" distribution-report and using variables

Jan 2, 2019 12:23 AM
(3141 views)

Two issues:

1. How do I get the sigma value from the histogram I just ploted to re-scale the bin of the plot?

2. How do I add ref lines (from different table) to each test name plot?

Thank you very much in advance!

"STD"- is the std value from the statistics table

"???"- is a value from "limits" table.

```
dt1 = Open();
:result << Set Data Type( Numeric, "Continuous" );
limits = dt1 << Summary( Group( :test_name ), Mean( Eval( "range_min" ) ), Mean( Eval( "range_max" ) ), );
Ntests = N Rows( limits );
vl = V List Box( Text Box( "Spec Limits Script" ) );
dt1 << Distribution(
Continuous Distribution( Column( :result ), Horizontal Layout( 1 ), Vertical( 0 ) ),
By( :test_name ),
SendToReport(
Dispatch(
{"result"},
"1",
ScaleBox,
{Min( 97.5173285198556 ), Max( 97.9576714801444 ), Inc(?STD?), Minor Ticks( 0 ),
Add Ref Line( limits[???,3], "Solid", "Black", "", 1 ), Add Ref Line( limits[???,4], "Solid", "Black", "", 1 )}
)
)
);
```

5 REPLIES 5

Highlighted
##

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

Re: "On the fly" distribution-report and using variables

See the relevant sections in 'Help > Books > Scripting Guide' and 'Help > Scripting Index'.

This shows the idea:

```
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Auto-generated axis
dist1 = dt << Distribution( Continuous Distribution( Column( :height ) ), Histograms Only );
// Assign some values used to update the histogram axis
ref1Val = 55;
ref2Val = 65;
incVal = 10;
// Expression to make distribution with user axis
makeDist =
Expr(
dist2 = dt << Distribution(
Continuous Distribution( Column( :height ) ), Histograms Only,
SendToReport(
Dispatch(
{"height"},
"1",
ScaleBox,
{
Inc(IncValTBD),
Add Ref Line( ref1ValTBD, "Solid", "Red", "", 1 ),
Add Ref Line( ref2ValTBD, "Solid", "Red", "", 1 )
}
),
Dispatch(
{"height"},
"Distrib Histogram",
FrameBox,
{
Grid Line Order( 1 ),
Reference Line Order( 3 )
}
)
)
)
);
// Update the expression with by baking in the chosen values
SubstituteInto(
makeDist,
Expr(IncValTBD), IncVal,
Expr(ref1ValTBD), ref1Val,
Expr(ref2ValTBD), ref2Val
);
// Remake the distribution
makeDist;
```

Highlighted
##

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

Re: "On the fly" distribution-report and using variables

Thanks but this is not the problem.

My issue is that I would like to perform "By( :test_name )" so I will get many different plots. I would like to change each of them by the statistics of each Distribution.

In your example you a priory set the values, and for only one type/test_name.

Thanks

My issue is that I would like to perform "By( :test_name )" so I will get many different plots. I would like to change each of them by the statistics of each Distribution.

In your example you a priory set the values, and for only one type/test_name.

Thanks

Highlighted
##

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

Re: "On the fly" distribution-report and using variables

OK. It seems like you then have two 'issues'; one is that the variables 'ref1Val', 'ref2Val' and 'IncVal' are assigned a priori, and the other is that you need to use a 'By' variable. But both are easily overcome.

The values mentioned could have been computed or looked up by other JSL (rather than given values through assignments, as above).

And when using a 'By' variable, the details may depend a little on whether or not you know the number of groups in advance. But the use of 'SubstituteInto()' will probably be the same. Some sample data and values would assist greatly if you need or want more help.

Highlighted
##

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

Re: "On the fly" distribution-report and using variables

Please see attached file.

Distribution by "test_name"

add line by range_max & range_min

bin size by std.

Thanks!

Highlighted
##

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

Re: "On the fly" distribution-report and using variables

This seems to be the same question as that which is now addressed in a parallel thread.

Article Labels

There are no labels assigned to this post.