cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

How can I Fit y by x, with 2 By groups, to display in rows with By as columns?

I have one x and multiple y.  I have only 2 By groups, although I could have more and I think this question would be valid.  I would like to display the y by x in columns with the By groups as columns.  

 

After creating the plots using Fit y by x, if I choose "Arrange in rows" = 2, the default display will place all By group 1 first, then By group 2, etc.  I'd like to visually observe how y1 responds to x within By group 1 side-by-side with By group 2.  To plot both By groups on the same y by x, or using Graph Builder, is too messy.

 

Can I teach the "Arrange in rows" feature to place the By groups in parallel columns?  I looked in Preferences and couldn't find a way to do it.  Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How can I Fit y by x, with 2 By groups, to display in rows with By as columns?

I checked the Scripting Index, and Fit Group does not appear to support the LineUp Box().  I believe you will get what you want, if you just replace

Fit Group(

with

nw = New Window( "Output",

the results will be displayed in your 2 columns

txnelson_0-1695763606081.png

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );

nw = New Window( "Output",
	Lineup Box( N Col( 2 ), 
 
		Bivariate(
			Y( :weight ),
			X( :age ),
			By( :sex ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
		Bivariate(
			Y( :height ),
			X( :age ),
			By( :sex ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		)
	) 
)

BTW, if you click on the JSL at the top of the Discussion Entry, and then cut and paste your JSL into the JSL Entry Window, the code is displayed in a more readable form for the Community Members

Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: How can I Fit y by x, with 2 By groups, to display in rows with By as columns?

Here is a simple method to align the output.  It does assume that there are data at each x and y combination

txnelson_0-1695751246809.png

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );

nw = New Window( "Output",
	Lineup Box( N Col( 2 ),
		bivariate(
			y( :height ),
			x( :weight ),
			by( :age,:sex  )
		)
	)
);
Jim
KurtAnderson
Level III

Re: How can I Fit y by x, with 2 By groups, to display in rows with By as columns?

Thanks Jim.  I'm less than a novice coder.  My code results in a blank page.  X and Y are continuous; By (material) is categorical.  All variable names are sanitized.  Thanks in advance for your help.

Fit Group(
	Lineup Box( N Col( 2 ), 
 
		Bivariate(
			Y( :"delP/delQ"n ),
			X( :M wt% ),
			By( :material ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
		Bivariate(
			Y( :" flow rate at 5 deg"n ),
			X( :M wt% ),
			By( :material ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
		Bivariate(
			Y( :" flow rate at 30 deg"n ),
			X( :M wt% ),
			By( :material ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
		Bivariate(
			Y( :" calc outlet (inches)"n ),
			X( :M wt% ),
			By( :material ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
		Bivariate(
			Y( :" wall angle (deg)"n ),
			X( :M wt% ),
			By( :material ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
		Bivariate(
			Y( :" rathole (inches)"n ),
			X( :M wt% ),
			By( :material ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
		Bivariate(
			Y( :"off gas"n ),
			X( :M wt% ),
			By( :material ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
	) 
)
txnelson
Super User

Re: How can I Fit y by x, with 2 By groups, to display in rows with By as columns?

I checked the Scripting Index, and Fit Group does not appear to support the LineUp Box().  I believe you will get what you want, if you just replace

Fit Group(

with

nw = New Window( "Output",

the results will be displayed in your 2 columns

txnelson_0-1695763606081.png

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );

nw = New Window( "Output",
	Lineup Box( N Col( 2 ), 
 
		Bivariate(
			Y( :weight ),
			X( :age ),
			By( :sex ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		),
		Bivariate(
			Y( :height ),
			X( :age ),
			By( :sex ),
			Fit Line( {Line Color( {212, 73, 88} )} )
		)
	) 
)

BTW, if you click on the JSL at the top of the Discussion Entry, and then cut and paste your JSL into the JSL Entry Window, the code is displayed in a more readable form for the Community Members

Jim

Recommended Articles