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
- :
- Density axis: How to access it in the Distribution platform (i.e. histogram)?

- 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

Nov 27, 2019 2:39 PM
(188 views)

I commonly add text onto graphs using "Add graphics script". I prefer to script it which means specifying x and y coordinates so the text appears in a good place on the graph.

I am stuck with histograms (in the Distribution platform) because I don't know how to get the y-axis scale which is based on the density axis. The x-axis is easy enough - it is based on the original data - but I need both x and y for my added text to appear in a meaningful place.

An example simple script is:

```
dist = Distribution(
Continuous Distribution( Column( :C1 ), Horizontal Layout( 1 ), Vertical( 0 ) ),
Histograms Only
);
rdist = dist << report; // rdist << Show Tree Structure;
axis_box = rdist[axis box( 1 )];
x_max = axis_box << Get Max; // show(x_max);
framebox = rdist[frame box( 1 )];
framebox << Add Graphics Script(
Text Color( "red" );
Text( Center Justified, {0.98 * x_max, 0.4}, "centered" ); // 0.4 is the y-value, but how to know the density axis scale?
);
```

Can anybody help? i.e. how to access details of the histogram's density axis so I can get the relevant information and then script where my desired text appears on the graph?

1 ACCEPTED SOLUTION

Accepted Solutions

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

If you specify to turn on the Density Axis for the histogram, you can access the Axis Settings for Axis Box(2)

```
dist=Distribution( Continuous Distribution( Column( :height ), Density Axis( 1 ) ) );
report(dist)[AxisBox(2)]<<get max;
```

Jim

2 REPLIES 2

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

If you specify to turn on the Density Axis for the histogram, you can access the Axis Settings for Axis Box(2)

```
dist=Distribution( Continuous Distribution( Column( :height ), Density Axis( 1 ) ) );
report(dist)[AxisBox(2)]<<get max;
```

Jim

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

Re: Density axis: How to access it in the Distribution platform (i.e. histogram)?

Thanks for the hint.

I turn on the density access at the start of the script so I can pull the min/max values.

Once these values are in the list - that will lead me to the coordinates I need - I simply remove the density access from the display:

`dist << density axis(0);`

Thanks again, Scott.