Hi,
I am fairly new to JMP and I would like to be able to add variable references lines based on formula in the graph builder.
When I plot the Y with several X (groups), I would like to generate for each X in graph builder:
- 2 lines with the formula (Mean-4*Std ; Mean+4*Std)
- Fill the range with a color
- Label with the value on each line
I tried to add these lines in JSL but without success.
The following code works for a constant (200), and a simple variable (Column Mean (Y)) but I fail at adding more complexity (calculating the right value for each X group, fill the blank between the 2 lines, add label for the line)
I took a JMP data sample to show a quick example of my goal below (.PNG attached).
Thanks a lot for your help
Open( "$SAMPLE_DATA/Cholesterol Stacked.jmp" );
temp = Graph Builder(
Size( 715, 637 ),
Variables( Y( :Y ), Group X( :Treatment ) ),
Elements( Points( Y, Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"Y",
ScaleBox,
{Min( -123.790318945935 ), Max( 574.600650636745 ), Inc( 100 ),
Minor Ticks( 1 )}
)
)
);
DataMean = 100; /* that code works with a constant*/
DataMean2 = Col Mean( :Y ); /* that code works with a simple variable */
report(temp)[axisbox(2)] << Add Ref Line( DataMean, "solid", red, "label1", 1 );
report(temp)[axisbox(2)] << Add Ref Line( DataMean2, "solid", red, "label2", 1 ); 