The World Statistics Day celebration continues here in the Community. We all need reliable data for sound decision making. Do you have a data source that you trust most? Head over to Discussions to tell us about it.
Choose Language Hide Translation Bar
Highlighted
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
Highlighted
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
Highlighted
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

Highlighted
yanee
Level III

Re: Append plots from for loop

Thanks a lot.
Article Labels

    There are no labels assigned to this post.