Graph Builder Mean LineI have a "points" plot in graph builder. I would like to add a mean line to the plot automatically, like one can do in Fit Y by X by selecting Fit Mean. I want it to happen automatically because I have a local data filter that I want to use to filter my data and each time I do so, I want the mean line to update with the mean of the filtered data. Basically, I would like the Mean Line to behave the same way the Line Of Fit currently does in graph builder in this situation. (You might say I would like to add a 0th order line of fit.)
I am very new to jmp, so please have patience with my ignorance. I have been trying to adding a script (Customize>Add script). If I could find a way to call the mean I could add Y Function(mean(), x), but I can't figure out the right way to do it. I guess the mean must be accessible because I can add a caption box that shows the mean (and this mean updates depending on how the data is filtered), but I can't figure out how to access this value. Thanks for any help you might have!
Re: Graph Builder Mean LineHere is one way to do it - I use a graphics script for drawing, but the logic for computing the mean and responding to row-state changes is done outside of the drawing.
Working: with data table exclude changes and adding or removing of data filters.
Needs work: (1) Data table and Y column are hard-coded. (2) It only works on the most recent report launched from the script. You can't run it multiple times, or use Redo Analysis to create a second working copy of the report.
NamesDefaultToHere(1);
dt=Open("$SAMPLE_DATA/Big Class.jmp");
gb=dt<<GRAPH builder=""></GRAPH>