I want to add text labels to a histogram with the mean and the standard deviation. I figured out how to do it through the customize function to add a graphics script. I'm still unclear on how to set the y-value, since it doesn't seem to be connected to the axis units, but I can work around that. My problem is that the labels do not update in response to a local data filter, or by hidding/excluding rows. The only thing that works is to delete rows. I am using col mean() & col std dev(); should I be using something else?
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Distribution(
Stack( 1 ),
Automatic Recalc( 1 ),
Continuous Distribution(
Column( :height ),
Summary Statistics( 1 ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Count Axis( 1 ),
Set Quantile Increment( 0.25 ),
Customize Summary Statistics(
Std Err Mean( 0 ),
Upper Mean Confidence Interval( 0 ),
Lower Mean Confidence Interval( 0 ),
N( 0 ),
Median( 0 )
)
),
Histograms Only,
Local Data Filter( Grouped by AND( 1 ), Add Filter( columns( :height ) ) ),
SendToReport(
Dispatch(
{"height"},
"Distrib Histogram",
FrameBox,
{Frame Size( 414, 428 ),
Add Graphics Script(
2,
Description( "Script" ),
Text(
Right Justified,
{72, 0.11},
"Mean: " || Format( Col Mean( :height ), "Fixed Dec", 12, 2 )
);
Text(
Right Justified,
{72, 0.105},
"StdDev: " || Format(
Col Std Dev( :height ),
"Fixed Dec",
12,
2
)
);
), Grid Line Order( 1 ), Reference Line Order( 3 )}
)
)
);