Choose Language Hide Translation Bar
Highlighted
Level I

## How to generate multiple plots

I wrote a JMP script where I plot data based on my original data. After I manipulate data, I plot it again, but now it can only show the plot for data after manipulation, not the plot for original data. I would like to compare two. Could anyone help with this? Below is the script I used to plot the data.

Graph Builder(
Size( 748, 531 ),
Show Control Panel( 0 ),
Automatic Recalc( 0 ),
Variables( X( :X_NOM_BIN ), Y( :Y_NOM_BIN ), Color( :Name( "Mean(UPDATED THICKNESS" ) ) ),
Elements( Points( X, Y, Legend( 6 ) ) )
);
10 REPLIES 10
Highlighted
Staff

## Re: How to generate multiple plots

I am not sure if you manipulate the data in the X role, the Y role, or both roles. You could save the manipulated data in a new column. You could also stack the original and manipulated data into one column and automatically create a label column to indicate which data is before and which data is after the manipulation.

Learn it once, use it forever!
Highlighted
Level I

## Re: How to generate multiple plots

Here is a more detailed description of my problem

For example, if I have a data table below (dt):

A B

1 2

2 4

3 6

4 8

And I manipulate data to make another table (dtNew)

A B

1 4

2 8

3 10

4 12

Now I want to plot this two on separate plots. How can I do that?

Highlighted
Staff

## Re: How to generate multiple plots

I see. Select Tables > Join. Change the Match option to Row Number. Now you have both data sets in the same table.

Learn it once, use it forever!
Highlighted
Level I

## Re: How to generate multiple plots

Thanks. But how to use JMP script to address this? I am creating a script that can do everything by just one click

Highlighted
Super User

## Re: How to generate multiple plots

Here is a very simple example on one way to do this:

Names Default To Here( 1 );
dt = Open( "\$SAMPLE_DATA/big class.jmp" );

dt << select where( :SEX == "F" );

dt2 = dt << subset( selected rows( 1 ), selected columns( 0 ) );

dt << bivariate( x( :Height ), y( :weight ) );

dt2 << bivariate( x( :Height ), y( :weight ) );

or

Names Default To Here( 1 );
Open( "\$SAMPLE_DATA/big class.jmp" );

data table("big class") << select where( :SEX == "F" );

data table("big class") << subset( selected rows( 1 ), selected columns( 0 ) );

data table("big class") << bivariate( x( :Height ), y( :weight ) );

data table("Subset of big class") << bivariate( x( :Height ), y( :weight ) );
Jim
Highlighted
Level I

## Re: How to generate multiple plots

Thanks. What if I have a third dimension to plot a heat map plot. What function should be used in plotting (rather than bivariate)?

Highlighted
Super User

## Re: How to generate multiple plots

You can use Graph Builder to generate a Heat Map, or you can use a Cell Map.

You should take a look at the documentation

Help==>Books==>Essential Graphing

Jim
Highlighted
Level I

## Re: How to generate multiple plots

Here is what I have. It always generate the second plot, but not the first. Could you tell me why?

dtSum << Graph Builder(
Size( 748, 531 ),
Show Control Panel( 0 ),
Automatic Recalc( 0 ),
Variables( X( :X_NOM_BIN ), Y( :Y_NOM_BIN ), Color( :UPDATED THICKNESS 1 ) ),
Elements( Points( X, Y, Legend( 6 ) ) )
);

dtSum6 << Graph Builder(
Size( 748, 531 ),
Show Control Panel( 0 ),
Automatic Recalc( 0 ),
Variables( X( :X_NOM_BIN ), Y( :Y_NOM_BIN ), Color( :Name( "RESIDUAL1_Normalized" ) ) ),
Elements( Points( X, Y, Legend( 6 ) ) )
);

Highlighted
Super User

## Re: How to generate multiple plots

What are the messages in the log?

What is the value of the variable DTSUM?  If you put

show(DTSUM);

just before

dtSum << Graph Builder(

it will print to the log what the value is......it needs to have the value of

dtSum = Data Table( "your data table name" )

Jim