cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
yanee
Level III

Append plots from for loop

Hi,

 

I try to append all plots from for loop to one window but it show only the first one. Below is my script.

Names Default To Here( 1 );
dt = Current Data Table();


list = dt << get column names( character );

New Window( "column selector",
	<<modal,
	Border Box( Left( 3 ), top( 2 ),
		V List Box(
			Text Box( "Group By" ),
			H List Box(
				H List Box(
					Panel Box( "Select Columns",
						lb = List Box( list ),
						Check Box( "merge" )
						
					),
					Panel Box( "selected group",
						Button Box( "select",
							<<set function(
								Function( {self},
									lb_selected << append( lb << get selected );
										
								)
							)
						),
						lb_selected = List Box( {} )
					), 
					
				)
			)
		)
	)
);

list = lb_selected << get items;

para_list = dt << get column names( "continuous" );

nw = New Window( "graphs", myVLB = V List Box() );

For( i = 1, i <= N Items( list ), i++,
	For( j = 1, j <= N Items( para_list ), j++,
		cp = oneway(
			Y( para_list[j] ),
			X( list[i] ),
			Automatic Recalc( 1 ),
			Means and Std Dev( 1 ),
			CDF Plot( 1 ),
			Box Plots( 1 ),
			Mean Diamonds( 1 ),
			Mean Error Bars( 1 ),
			Std Dev Lines( 1 ),
			Connect Means( 1 ),
			X Axis Proportional( 0 ),
			Points Jittered( 1 ), 

		);
		
		myVLB << append( Report( cp ) );
	);
			
			
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Append plots from for loop

I changed your code to set the "List" variable inside of the Modal box.  I also changed the code to clean up itself by deleting the individual output.

Names Default To Here( 1 );
dt = Current Data Table();


list = dt << get column names( character );

New Window( "column selector",
	<<modal,
	Border Box( Left( 3 ), top( 2 ),
		V List Box(
			Text Box( "Group By" ),
			H List Box(
				H List Box(
					Panel Box( "Select Columns",
						lb = List Box( list ),
						Check Box( "merge" )
						
					),
					Panel Box( "selected group",
						Button Box( "select",
							<<set function(
								Function( {self},
									lb_selected << append( lb << get selected );
									list = lb_selected << get items;	
								)
							)
						),
						lb_selected = List Box( {} )
					), 
					
				)
			)
		)
	)
);


para_list = dt << get column names( "continuous" );

nw = New Window( "graphs", myVLB = V List Box() );

For( i = 1, i <= N Items( list ), i++,
	For( j = 1, j <= N Items( para_list ), j++,
		cp = oneway(invisible,
			Y( para_list[j] ),
			X( list[i] ),
			Automatic Recalc( 1 ),
			Means and Std Dev( 1 ),
			CDF Plot( 1 ),
			Box Plots( 1 ),
			Mean Diamonds( 1 ),
			Mean Error Bars( 1 ),
			Std Dev Lines( 1 ),
			Connect Means( 1 ),
			X Axis Proportional( 0 ),
			Points Jittered( 1 ), 

		);
		
		myVLB << append( Report( cp ) );
		cp << delete;
	);
			
			
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Append plots from for loop

I changed your code to set the "List" variable inside of the Modal box.  I also changed the code to clean up itself by deleting the individual output.

Names Default To Here( 1 );
dt = Current Data Table();


list = dt << get column names( character );

New Window( "column selector",
	<<modal,
	Border Box( Left( 3 ), top( 2 ),
		V List Box(
			Text Box( "Group By" ),
			H List Box(
				H List Box(
					Panel Box( "Select Columns",
						lb = List Box( list ),
						Check Box( "merge" )
						
					),
					Panel Box( "selected group",
						Button Box( "select",
							<<set function(
								Function( {self},
									lb_selected << append( lb << get selected );
									list = lb_selected << get items;	
								)
							)
						),
						lb_selected = List Box( {} )
					), 
					
				)
			)
		)
	)
);


para_list = dt << get column names( "continuous" );

nw = New Window( "graphs", myVLB = V List Box() );

For( i = 1, i <= N Items( list ), i++,
	For( j = 1, j <= N Items( para_list ), j++,
		cp = oneway(invisible,
			Y( para_list[j] ),
			X( list[i] ),
			Automatic Recalc( 1 ),
			Means and Std Dev( 1 ),
			CDF Plot( 1 ),
			Box Plots( 1 ),
			Mean Diamonds( 1 ),
			Mean Error Bars( 1 ),
			Std Dev Lines( 1 ),
			Connect Means( 1 ),
			X Axis Proportional( 0 ),
			Points Jittered( 1 ), 

		);
		
		myVLB << append( Report( cp ) );
		cp << delete;
	);
			
			
);
Jim
yanee
Level III

Re: Append plots from for loop

Thanks a lot.

Recommended Articles