Choose Language Hide Translation Bar
Community Trekker

## plot regression line through overlay groups

Hello,

I want to create an x-y graph with a single regression line passing through data points that are differentiated by color for each of four groups. I can create an overlay plot with different colored groups, see below:

But can't do regression in Overlay mode. This is pretty simple to do in Proc Gplot so I figure there's a way in JMP.

Any pointers?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: plot regression line through overlay groups

You can use Graph Builder to do this.  Plot meanHI vs population, and drag the Density column into the Color area.  Then click on the Line of Fit toolbar icon.

Here's a scripted example using Big Class:

dt = open("\$sample_data\Big Class.jmp");

dt << Graph Builder(

Show Control Panel( 0 ),

Variables( X( :weight ), Y( :height ), Color( :age ) ),

Elements(

Points( X, Y, Legend( 1 ), Jitter( 1 ) ),

Line Of Fit(

X,

Y,

Legend( 4 ),

Confidence of Fit( 0 ),

Confidence of Prediction( 0 ),

Degree( "Linear" ),

Equation( 0 ),

Root Mean Square Error( 0 ),

R²( 0 )

)

)

);

2 REPLIES 2
Super User

## Re: plot regression line through overlay groups

You can use Graph Builder to do this.  Plot meanHI vs population, and drag the Density column into the Color area.  Then click on the Line of Fit toolbar icon.

Here's a scripted example using Big Class:

dt = open("\$sample_data\Big Class.jmp");

dt << Graph Builder(

Show Control Panel( 0 ),

Variables( X( :weight ), Y( :height ), Color( :age ) ),

Elements(

Points( X, Y, Legend( 1 ), Jitter( 1 ) ),

Line Of Fit(

X,

Y,

Legend( 4 ),

Confidence of Fit( 0 ),

Confidence of Prediction( 0 ),

Degree( "Linear" ),

Equation( 0 ),

Root Mean Square Error( 0 ),

R²( 0 )

)

)

);

Community Trekker

## Re: plot regression line through overlay groups

That worked. Thank you for the speedy reply and the scripting example.