Hi,
I'm experimenting with the bubble statement in sgplot to duplicate some code done in proc template. I need to strip out all axes in the plot produced by:
data test;
x=1; y=2; size=68; output;
x=2; y=2; size=49; output;
x=3; y=2; size=77; output;
x=4; y=2; size=6 ; output;
x=1; y=1; size=70; output;
x=2; y=1; size=46; output;
x=3; y=1; size=73; output;
x=4; y=1; size=10; output;
run;
title;
ods html;
proc sgplot data=test;
bubble x=x y=y size=size/datalabel=size
colormodel=(red blue green brown)
colorresponse=x
fill
transparency=.5
datalabelpos=center
datalabelattrs=(color=black);
run;
Eventually I also want to make the overall bubble sizes a bit larger and the edges fade out.
Thanks!
--Ben
ods html;
ods graphics / reset width=6in height=2in noscale;
proc sgplot data=test noborder;
bubble x=x y=y size=size/datalabel=size
colormodel=(red blue green brown)
colorresponse=x
fill bradiusmax=36
transparency=.5
datalabelpos=center
datalabelattrs=(color=black)
datalabelattrs=(size=9 weight=bold);
xaxis display=none;
There is no feature for edge fading. You can use DataSkins to get other effects.
yaxis display=none;
run;
ods html;
ods graphics / reset width=6in height=2in noscale;
proc sgplot data=test noborder;
bubble x=x y=y size=size/datalabel=size
colormodel=(red blue green brown)
colorresponse=x
fill bradiusmax=36
transparency=.5
datalabelpos=center
datalabelattrs=(color=black)
datalabelattrs=(size=9 weight=bold);
xaxis display=none;
There is no feature for edge fading. You can use DataSkins to get other effects.
yaxis display=none;
run;
Thanks, Sanjay! Is there a way to lose the gradient bar on the right side?
--Ben
To get rid of the gradient legend:
proc sgplot data=test noautolegend;
You will probably want to do this:
proc sgplot data=test nowall noborder;
xaxis display=none;
yaxis display=none;
.....
run;
Hi Sanjay,
Thanks for the link and insight. I had carefully avoided bringing up the choice of visual presentation as the client had chosen that and approved the representation. So I was stuck. But I couldn't agree more on the thoughts of when and when not to use bubble charts.
--Ben
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.