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;
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;
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.
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;
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.