cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

For loop

I would like to generate all these plots in one tab, rather than generating 50 different pages, can anyone help ? thank you 

dt = Current Data Table();
For( i = 1, i <= 50, i++,
	dt << Bivariate(
		Y( Column( dt, "u" || Char( i ) ) ),
		X( Column( dt, "oven.T" ) ),
		Fit Line( {Line Color( {212, 73, 88} )} )
	)
);

 

2 REPLIES 2
txnelson
Super User

Re: For loop

Here is one way to do what you want

Names Default To Here( 1 );
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
colListY = {};
For( i = 1, i <= 10, i++,
	Insert Into( colListY, "NPN" || Char( i ) )
);

dt << Bivariate(
	Y( Eval( colListY ) ),
	X( Column( dt, "PNP1" ) ),
	Fit Line( {Line Color( {212, 73, 88} )} )
);

Here is another way

Names Default To Here( 1 );
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
colListY = {};
For( i = 1, i <= 10, i++,
	Insert Into( colListY, "NPN" || Char( i ) )
);
New Window( "My Output",
	H List Box(
		For( i = 1, i <= 10, i++,
			dt << Bivariate(
				Y( Column( dt, colListY[i] ) ),
				X( Column( dt, "PNP1" ) ),
				Fit Line( {Line Color( {212, 73, 88} )} )
			)
		)
	)
);
Jim

Re: For loop

Thank you!