I am creating plots where a label is being printed onto a graph which I’m building from scratch. The x,y co-ordinates and labels used in the plot are matrices which are created from columns in a JMP table.
This works fine for a single plot, but the problem is I can’t save this to a journal, or have multiple plots of different data open at the same time, because the graphics script updates every time the matrices change! This means that the only way I can make the maps useful is by saving as a picture.
Is it possible to create the graph in such a way as the text becomes static? I would ideally like to produce reports with multiple such plots.
I've had the same problem many times of the charts automatically updating (so they all end up being identical to the one created by the last run of the loop), and usually deal with it by doing something along the lines of this example:
thanks for your reply!! That's a great script, very clever. Now I just need to figure out how it works and how to apply it :-)
To any JMP people reading this - is it possible that this kind of functionality could be built in to future versions? Sometimes it's useful to have graphs which auto-update (one of the most useful features of JMP in fact!) but sometimes static graphs are necessary.
The issue in all of this is that the script is stored as an expression (unevaluated), meaning that every reference within it that you have to some variable is NOT evaluated prior to storage, but only each time the script is run. This works OK the first time, because as soon as the GraphBox arg list ends, its gets run the first time. But the next time there's an update, it uses the then-current value of the global var matrix1.
The code snippet above solves that by replacing the reference with the value at the time the script is stored. First, EvalExpr() goes through and fully evaluates the arguments to each Expr() within its argument (meaning all of the matrix1's are replaced with their values). Then, the entire resulting expression is evaluated, creating a GraphBox call that includes a script with NUMBERS instead of variable names in its graphics script.