BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
brookeewhite1
Quartz | Level 8

Is it possible to add a trendline / regression line to a bubble chart created with gplot?  I have a gplot statement similar to this, which successfully creates a bubble plot, however I want to add a trendline. I saw options for doing this on scatterplots but couldn't find anything for a bubble plot.  I am programming within SAS Enterprise Guide 7.1.  Thanks in advance!

 

proc gplot data=LIBNAME.MYDATA;

bubble Errors*Volume=share / bsize=7 bcolor=clear

bfill=solid

ctext=black cframe=white

haxis=axis1 vaxis=axis2

href=16 chref=blue lhref=2

vref=5 cvref=blue lvref=2

annotate=labels;

 

 

run;

quit;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

You can overlay the Bubble and Reg Plots with PROC SGPLOT like this

 

title 'Bubble Plot with Regression Line';
proc sgplot data=sashelp.class noautolegend;
  bubble x=height y=weight size=age;
  reg x=height y=weight / nomarkers;
run;
title;

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

It's certainly possible in PROC SGPLOT.

 

I suspect it is possible (but haven't actually tried) in PROC GPLOT by using the I=RL option in the SYMBOL statement.

--
Paige Miller
PeterClemmensen
Tourmaline | Level 20

You can overlay the Bubble and Reg Plots with PROC SGPLOT like this

 

title 'Bubble Plot with Regression Line';
proc sgplot data=sashelp.class noautolegend;
  bubble x=height y=weight size=age;
  reg x=height y=weight / nomarkers;
run;
title;
brookeewhite1
Quartz | Level 8

Thank you, draycut!

 

This did produce a nice looking chart with regression line. I had quite a few options specified in GPLOT. Now that I've switched from GPLOT to SGPLOT, I'll see if I can find the same or similar options available under SGPLOT.

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2091 views
  • 1 like
  • 3 in conversation