BookmarkSubscribeRSS Feed
tc
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

Patriotic Pom Pom WreathPatriotic 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;

 

2 REPLIES 2
Jay54
Meteorite | Level 14

Nice work, TC.  Great to see this visually appealing graphic using skins with bubbles.  No annotation needed.

Ksharp
Super User

@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;

SGPlot31.png

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
  • 2 replies
  • 1550 views
  • 18 likes
  • 3 in conversation