Subscribe Bookmark RSS Feed

Static text on plots

matthewh

Community Trekker

Joined:

Jun 23, 2011

Hi,

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.

Cheers,
Matt.
3 REPLIES
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:

matthewh

Community Trekker

Joined:

Jun 23, 2011

Hi David,

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.

Cheers,
Matt.
cakinli

Community Trekker

Joined:

Jun 23, 2011

How about something like

Eval(EvalExpr(GraphBox(yadda yadda, blah blah blah,
rect(expr(matrix1[1][1]), expr(matrix1[1][2]), expr(matrix1[2][1]), expr(matrix1[2][2])),
...
) );

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.

... at least, in theory anyway

-Cengiz