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

Hello there,

 

Can anyone help with changing the size of the bubbles in SGPLOT? The bubbles in my graph below are not proportional to the size of each cell. I would like to make them smaller than how they look in the graph. In the preceeding data step I tried to change the value of the "size" variable but it did not seem to help.

 

Thanks a lot in advance!

 

Recep

 

data _009;
merge _007 _008 rprt1516.bc_population_estimates_by_age;
by age_group_1;
dad_per_100000=100000*dad_count/population;
bctr_per_100000=100000*bctr_count/population;

size=0.1;

run;

 

proc sgplot data=_009;
bubble x=age_group_1 y=dad_count size=size / LEGENDLABEL= "All hospitalizations"
                                                                             FILLATTRS=(color=red transparency=0.6);
bubble x=age_group_1 y=bctr_count size=size / LEGENDLABEL= "BCTR hospitalizations (ISS>=9 or died)"
                                                                             FILLATTRS=(color=blue transparency=0.6);

xaxis display=all label='Age group' fitpolicy=rotate;
yaxis label='Total cases' offsetmin=.17;
run;

 

SGPlot15.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

For Bubble plot, size=column uses the BRADIUSMIN and BRADIUSMAX to map the values from the column.  If the column has only one value, all bubbles will be of the size specified by BRADIUSMIN.  So, in this case you can set the BRADIUSMIN and BRADIUSMAX values to what you want.  Please see product documentation.  

View solution in original post

6 REPLIES 6
Reeza
Super User

Can you post an example that references a SASHELP dataset so we can replicate the issue.

 

It should be the SIZE that controls the size. 

Was there any messages in the log?

Recep
Quartz | Level 8

Hi Reeza,

 

Here is the dataset:

 

age_group_1dad_countbctr_countpopulationdad_per_100000bctr_per_100000size
0-151580241691527228.4834.850.1
16-19575156272558210.9657.2360.1
20-24938280326885286.9585.6570.1
25-291004293317345316.3792.3290.1
30-34856241328085260.9173.4570.1
35-39800224312835255.7371.6030.1
40-44920229304587302.0575.1840.1
45-491017292327972310.0989.0320.1
50-541385377351517394.01107.2490.1
55-591577407351325448.87115.8470.1
60-641650423316552521.24133.6270.1
65-691751390281853621.25138.370.1
70-741836316203061904.16155.6180.1
75-7921092971466721437.9202.4930.1
80-8428023651069922618.89341.1470.1
85-893088375696434434.04538.460.1
90+3146298422037454.45706.1110.1

 

I haven't got any message in the log. Sanjay's solution was quite easy to apply.

Jay54
Meteorite | Level 14

For Bubble plot, size=column uses the BRADIUSMIN and BRADIUSMAX to map the values from the column.  If the column has only one value, all bubbles will be of the size specified by BRADIUSMIN.  So, in this case you can set the BRADIUSMIN and BRADIUSMAX values to what you want.  Please see product documentation.  

Recep
Quartz | Level 8

Thanks a lot Sanjay! It resolved my problem easily...

DanH_sas
SAS Super FREQ

Based on your data step, it appears that you are trying to create bubbles of a constant size. The intent of a BUBBLE plot is to have varying sized bubbles to reflect the changes in a third variable. I think what you might want is a SCATTER plot with CIRCLEFILLED markers. Something like this:

 

proc sgplot data=sashelp.class;
scatter x=weight y=height / markerattrs=(symbol=circlefilled size=21px) 
           filledoutlinedmarkers group=sex;
run;

 

Hope this helps!

Dan

Recep
Quartz | Level 8

Thanks a lot for your response Dan! Sanjay's solution resolved my problem. Though I'll try to use the scatter option instead of bubbles as I believe there are a bit more flexibility with the scatter.

 

Cheers,

 

Recep

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
  • 6 replies
  • 2379 views
  • 0 likes
  • 4 in conversation