cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
scottahindle
Level IV

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

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
txnelson
Super User

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

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

View solution in original post

2 REPLIES 2
txnelson
Super User

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

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
scottahindle
Level IV

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.