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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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