Choose Language Hide Translation Bar
Highlighted
aumair
Level III

Merging graphs in same window

Hello, 

I am running a loop that subsets a data table and plots a variability chart from the subset table. Script is something like below:

 

//lot list is a string list...

lot_count = Length( lot_list);

For( i= 1, i <= lot_count, jj++,
      subset a data table from main table depending on some criteria
      do gymnastics with the subset table and plot a variablity chart

); // for loop closed. At the end I will have a number of variablity charts in separate windows

 

What I wanted to do is to merge all the plots in same window...

 

My approach is to use something like this after the loop is finished: 

New Window( "Combined graphs", lineup box(ncol(2), v1, v2, v3,v4););

But I am having trouble in:

1) Assigning a variable v1, v2, v3, ... to a variablity chart based on the interation number within the loop

2) Provide dynamic list to New Window(), where each variable of list {v1, v2, v3, ...} is refering to a variablity chart.

 

Thanks in advance for any help! A different approach would be acceptable! 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Merging graphs in same window

Here is a simple script illustrating what you are asking for:

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/blood pressure.jmp" );

// get the numerical columns
numColumnNames = dt << get column names( numeric, string );

// Create an output display window
New Window( "Combined graphs", lub = Lineup Box( N Col( 2 ) ) );

// Loop accross the variables and add them to the Charts to the display
For( i = 2, i <= N Items( numColumnNames ), i++,
	vc = Variability Chart(invisible, Y( Eval( numColumnNames[i] ) ), X( :dose ) );
	lub << append( Report( vc ) );
	vc << close window;
);
Jim

View solution in original post

5 REPLIES 5
Highlighted
pmroz
Super User

Re: Merging graphs in same window

Can you use graph builder and drag the lot number to the "Wrap" role?  That will automatically create a separate mini-graph for each lot number.

Highlighted
aumair
Level III

Re: Merging graphs in same window

Thanks for your suggestion. I wanted this to be fully automated - would look into graph builder scripting! Also after subsetting the table, I am doing various things with the subset table. If I do these operation on the main table, it would get a bit complex - sorry probably difficult to explain :)
Highlighted
txnelson
Super User

Re: Merging graphs in same window

Here is a simple script illustrating what you are asking for:

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/blood pressure.jmp" );

// get the numerical columns
numColumnNames = dt << get column names( numeric, string );

// Create an output display window
New Window( "Combined graphs", lub = Lineup Box( N Col( 2 ) ) );

// Loop accross the variables and add them to the Charts to the display
For( i = 2, i <= N Items( numColumnNames ), i++,
	vc = Variability Chart(invisible, Y( Eval( numColumnNames[i] ) ), X( :dose ) );
	lub << append( Report( vc ) );
	vc << close window;
);
Jim

View solution in original post

Highlighted
LSYAW
Level I

Re: Merging graphs in same window

Hi txnelson,

Thanks for the suggestion.

I tried with one original image and a crop image manage combine to a new window and save in journal. But somehow the original image was replaced by the crop image. and the size of the image were the same.  Wander if you have a way fix it.

 

Names Default To Here( 1 );
img = Open( "$SAMPLE_IMAGES/tile.jpg", JPG );
nw1 = New Window( "Original Image", img );
{w, h} = img << Get Size;
img << Crop( Left( 50 ), Right( w - 50 ), Top( 50 ), Bottom( h - 50 ) );

nw2 = New Window( "Smaller Image", img );

nw = New Window( "Combined Images", Lineup Box( N Col( 2 ), nw1, nw2 ) );
nw << Save Journal( "/C:/Users/User/Desktop/My Processed Image Journal.jrn" );

 

TQ

ECLSYAW

 

Highlighted
aumair
Level III

Re: Merging graphs in same window

Thanks a lot txnelson!! 

append() made it so easy - and I didn't know about that.

 

Article Labels

    There are no labels assigned to this post.