Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Appending multiple graph boxes to a single window without them copying the most ...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 26, 2020 9:37 AM
(512 views)

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

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

4 REPLIES 4

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.

Learn it once, use it forever!

- Tags:
- ll

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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!

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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]
)
);
);
```

Learn it once, use it forever!

Article Labels

There are no labels assigned to this post.