cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
JonathanL
Level II

Is it possible to display multiple fit lines of different degrees in a single plot?

I would like to display both linear and quadratic fit lines in the same plot. Essentially a combination of the two plots I've attached to this post.

graph 1graph 1graph 2graph 2

Is this possible in JMP?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Staff

Re: Is it possible to display multiple fit lines of different degrees in a single plot?

Given your intention, it might be better to look at 'Analyze > Fit Y By X'.

 

This script:


dt = Open("$SAMPLE_DATA/Big Class.jmp");

biv = dt << Bivariate(
				Y( :height ),
				X( :weight ),
				GroupBy( :sex ),
				FitLine(),
				FitPolynomial(2)
				)

will produce output like this:

Screenshot 2020-05-22 at 16.59.24.png

and there are lots of additional customizations you could use.

View solution in original post

5 REPLIES 5

Re: Is it possible to display multiple fit lines of different degrees in a single plot?

I don't think you can do this in Graph Builder, but you can in Fit Y by X.

 

It looks like you may have an overlay variable, just be sure to use the Fit Y by X "Group By" command before fitting the lines and the quadratic polynomials.

Dan Obermiller
ian_jmp
Staff

Re: Is it possible to display multiple fit lines of different degrees in a single plot?

Given your intention, it might be better to look at 'Analyze > Fit Y By X'.

 

This script:


dt = Open("$SAMPLE_DATA/Big Class.jmp");

biv = dt << Bivariate(
				Y( :height ),
				X( :weight ),
				GroupBy( :sex ),
				FitLine(),
				FitPolynomial(2)
				)

will produce output like this:

Screenshot 2020-05-22 at 16.59.24.png

and there are lots of additional customizations you could use.

JonathanL
Level II

Re: Is it possible to display multiple fit lines of different degrees in a single plot?

Excellent, this worked. Thank you.

Re: Is it possible to display multiple fit lines of different degrees in a single plot?

I agree with @Dan_Obermiller and @ian_jmp but if you really need to use Graph Builder, then the approach is to first fit the models separately and save each one of them as column formula. Then add these columns in the Y drop zone of Graph Builder. Now change the rendering element to Formula.

julian
Community Manager Community Manager

Re: Is it possible to display multiple fit lines of different degrees in a single plot?

Hi @JonathanL,

This can be done in Graph Builder, if you would prefer to do it there. If you would like to display a second line element using a different degree, you'll need to add that second element, either by holding the shift key and clicking the line of fit element, or dragging the line of fit element into the graph after you've already selected it. Then, you can change the degree for this second line of fit element. Like every other element, variables in other roles are respected unless disabled, so if you have a variable in the Overlay role, both of these line elements will display lines of fit separately for the levels of the Overlay variable.

 

Dual.gif

 

 

@julian