Patriotic Pom Pom Wreath
A SAS ODS Graphics bubble plot take on a neat Etsy Patriotic Pom Pom Wreath. Have a Happy 4th, all!
* Fun With SAS ODS Graphics: Patriotic Pom Pom July 4th Wreath (Bubble+Scatter Plots)
Inspired by Patriotic Pom Pom wreath at etsy.com/listing/964348987/patriotic-pom-pom-wreath-red-white-and;
proc format; * Assign red/white/blue colors based on angles of wedges;
value rwb -250--140='Blue' -270--260, 80-90, 20-40, -40--20, -100--80 ='Red'
50-70, -10-10, -70--50, -130--110='White';
data wreath; * Generate points for July 4th 'wreath';
retain size 1 txt 'HAPPY*4TH OF JULY!';
do a=90 to -270 by -10; * Generates points for balloons;
do r=.7 to 1 by .15; * Three points for each angle;
x=r*cos(a*constant('pi')/180);
y=r*sin(a*constant('pi')/180);
c=put(a,rwb.); * Assign color;
output;
end;
end;
x=.; y=.; * Generate points for stars;
do a=-150 to -240 by -15; * In the blue wedge of wreath;
if r=.9 then r=.8; else r=.9; * Alternate location of stars (radius=.8 or .9);
xs=r*cos(a*constant('pi')/180);
ys=r*sin(a*constant('pi')/180);
output;
end;
xs=.; ys=.; * Generate point for text;
xt=0; yt=0;
output;
* Patriotic Pom Pom Wreath (Bubble+Scatter Plots);
proc sgplot data=wreath aspect=1 noautolegend noborder;
styleattrs datacolors=(red white navy);
symbolchar name=uniStar char='2605'x; * Unicode 5-pointed star;
bubble x=x y=y size=size / /* Red, white and blue bubbles */
dataskin=pressed group=c nooutline bradiusmin=.23in bradiusmax=.25in;
scatter x=xs y=ys / /* White stars */
markerattrs=(symbol=unistar size=36pt color=white);
xaxis display=none; yaxis display=none; * Look Ma, no axes!;
text x=xt y=yt text=txt / strip textattrs=(size=18pt color=navy weight=bold)
splitchar='*' splitpolicy=splitalways contributeoffsets=none; * Happy 4th of July!;
run;
Nice work, TC. Great to see this visually appealing graphic using skins with bubbles. No annotation needed.
@tc ,
Forgive me to steal your code to plot Chinese flag .
proc format; * Assign red/white/blue colors based on angles of wedges;
value rwb -250--140='Blue' -270--260, 80-90, 20-40, -40--20, -100--80 ='Red'
50-70, -10-10, -70--50, -130--110='White';
data wreath; * Generate points for July 4th 'wreath';
retain size 1 txt '10.1*国庆节*快乐';
do a=90 to -270 by -10; * Generates points for balloons;
do r=.5 to 1 by .15; * Three points for each angle;
x=r*cos(a*constant('pi')/180);
y=r*sin(a*constant('pi')/180);
c=put(a,rwb.); * Assign color;
output;
end;
end;
x=.; y=.; * Generate points for stars;
start=unicode('\u2605');
r=0.5; a=-210 ;
xs=r*cos(a*constant('pi')/180);
ys=r*sin(a*constant('pi')/180);
rotate=30;
output;
r=0.55; a=-230 ;
xs=r*cos(a*constant('pi')/180);
ys=r*sin(a*constant('pi')/180);
rotate=0;
output;
r=0.7; a=-240 ;
xs=r*cos(a*constant('pi')/180);
ys=r*sin(a*constant('pi')/180);
rotate=-30;
output;
r=0.9; a=-240 ;
xs=r*cos(a*constant('pi')/180);
ys=r*sin(a*constant('pi')/180);
rotate=-60;
output;
xs=.; ys=.;
r=0.9; a=-215 ;
xs1=r*cos(a*constant('pi')/180);
ys1=r*sin(a*constant('pi')/180);
rotate=0;
output;
xs1=.; ys1=.; * Generate point for text;
xs=.; ys=.; * Generate point for text;
xt=0; yt=0;
output;
* Patriotic Pom Pom Wreath (Bubble+Scatter Plots);
proc sgplot data=wreath aspect=1 noautolegend noborder;
bubble x=x y=y size=size / fillattrs=(color=red) /* Red, white and blue bubbles */
dataskin=pressed nooutline bradiusmin=.23in bradiusmax=.25in;
text x=xs y=ys text=start/ strip textattrs=(size=20pt color=yellow weight=bold) contributeoffsets=none rotate=rotate ;
text x=xs1 y=ys1 text=start/ strip textattrs=(size=50pt color=yellow weight=bold) contributeoffsets=none rotate=rotate ;
xaxis display=none; yaxis display=none; * Look Ma, no axes!;
text x=xt y=yt text=txt / strip textattrs=(size=18pt color=red weight=bold)
splitchar='*' splitpolicy=splitalways contributeoffsets=none; * Happy 4th of July!;
run;
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.