cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
FuzzyWolf
Level I

Appending multiple graph boxes to a single window without them copying the most recent append

I'm trying to create a window that has several graph boxes being appended to help visualize the data that I'm processing.  The setup I have is similar to this.

 

thisWindow = new window("Test Window");
for(x = 1, x <=nitems(thingsToDraw), x++,
	thisWindow << append(
		graph box(
			(setup of X and Y axis, scales and such)
			(for loops that create dynamic shapes in the graph box)
		);
	);
);

The problem is, every time it appends a new graph box, it changes all the previous graph boxes to match the new one.  I'm sure there's a way to isolate the graph boxes so they quit updating each other after appending new ones, but I can't figure it out.  If I make the boxes all unique by sizing and setup, they don't seem to copy each other.  But that defeats the purpose of the loop and the reason I'm trying to create them in the first place.  I've tried setting this up as a function and calling it, as well as setting it up as an expression that's evaluated on the fly.  Both results are the same.

 

I'm using JMP 14.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Appending multiple graph boxes to a single window without them copying the most recent append

Here is a simple solution.  It does not copy the Graph Box() to the output window, but rather copies a Picture of the graph box.

thisWindow = new window("Test Window");
for(x = 1, x <=nitems(thingsToDraw), x++,
	thisWindow << append(
		graph box(
			(setup of X and Y axis, scales and such)
			(for loops that create dynamic shapes in the graph box)
		)<<get picture;
	);
);
Jim

View solution in original post

4 REPLIES 4

Re: Appending multiple graph boxes to a single window without them copying the most recent append

I bet that all your graphics scripts use the same variables and that you change the value in these variables with each iteration. If that is the case, then all the plots will re-draw with the new values. You must convert the variable to a literal value for each graphics script.

txnelson
Super User

Re: Appending multiple graph boxes to a single window without them copying the most recent append

Here is a simple solution.  It does not copy the Graph Box() to the output window, but rather copies a Picture of the graph box.

thisWindow = new window("Test Window");
for(x = 1, x <=nitems(thingsToDraw), x++,
	thisWindow << append(
		graph box(
			(setup of X and Y axis, scales and such)
			(for loops that create dynamic shapes in the graph box)
		)<<get picture;
	);
);
Jim
FuzzyWolf
Level I

Re: Appending multiple graph boxes to a single window without them copying the most recent append

Ha!  That's what I needed.  I was trying to figure out how to copy it somehow as I figured that would be easier, but I couldn't find how.  Copying a picture and then adding it to a picture box works perfectly!  And I can grab just the graph box itself without the axis labels and such for the image, which improves what I'm trying to do.

 

Thanks!

Re: Appending multiple graph boxes to a single window without them copying the most recent append

This example demonstrates the approach that I suggested.

 

Names Default to Here( 1 );

nw = New Window( "Multiple Plots",
	vlb = V List Box()
);

a = [ 1, 2, 3, 4 ];
b = [ 2, 4, 6, 8 ];
c = [ 4, 3, 2, 1 ];
d = [ 8, 6, 4, 2 ];

For( plot = 1, plot <= N Row( a ), plot++,
	Eval(
		Substitute(
			Expr(
				vlb << Append(
					Graph Box(
						X Scale( -6, 6),
						Y Name( "Amplitude" ),
						Y Scale( -10, 10 ),
						Y Function( aa + bb * Sine( cc * x / dd ), x )
					)
				);
			),
			Expr( aa ), a[plot],
			Expr( bb ), b[plot],
			Expr( cc ), c[plot],
			Expr( dd ), d[plot]
		)
	);
);