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

SAS Polar FlowerSAS Polar FlowerCraft Project for KidsCraft Project for Kids

What do you get when you cross @Rick_SAS's Polar Rose code with kids' crafts? Polar flowers for Mother's Day!

* Fun With SAS ODS Graphics: Mother's Day Polar Flower
  References: blogs.sas.com/content/iml/2015/12/16/polar-rose.html
              matrixlab-examples.com/polar-plots.html
              thebestideasforkids.com/flower-template;

data flower;                               /* Generate points for "flower" */
id=1;
do theta = 0 to 2*constant("pi") by 0.01;
  r = sqrt(abs(sin(3*theta)));             /* Six-petaled "flower" */  
  x = r*cos(theta);                        /* Convert to x/y */
  y = r*sin(theta);
  output;
end;
x=.; y=.; x2=0; y2=0; mom='MOM'; output;   /* Generate "pistil" */
                                           /* Polygon/scatter/text plots */
proc sgplot data=flower aspect=1 noborder noautolegend;
polygon x=x y=y id=id / fill fillattrs=(color=cxb19cd9);
scatter x=x2 y=y2 / markerattrs=(symbol=circlefilled color=cxfadadd size=90pt);
text x=x2 y=y2 text=mom / textattrs=(color=white size=28pt color=purple);
xaxis display=none min=-1 max=1 offsetmin=0 offsetmax=0;
yaxis display=none min=-1 max=1 offsetmin=0 offsetmax=0;
2 REPLIES 2
Jay54
Meteorite | Level 14

Nice work TC.  I wonder if the same can be done using the ELLIPSEPARM statement(s).

tc
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

You know, I forgot there was an ELLIPSEPARM statement for PROC SGPLOT! Gave it a quick shot, and it worked fine for generating a circle to replace the SCATTER plot, but I couldn't get a good shape for the petals. Also, I found that tweaking the equation for the petals yielded a more pleasing (to me at least!) shape for the petals:

Take 2!Take 2!


* Fun With SAS ODS Graphics: Mother's Day Polar Flower References: blogs.sas.com/content/iml/2015/12/16/polar-rose.html matrixlab-examples.com/polar-plots.html thebestideasforkids.com/flower-template; data flower; /* Generate points for "flower" */ id=1; do theta = 0 to 2*constant("pi") by 0.01; r = abs(sin(3*theta))**(1/4); /* Six-petaled "flower" */ x = r*cos(theta); /* Convert to x/y */ y = r*sin(theta); output; end; x=.; y=.; x2=0; y2=0; mom='MOM'; output; /* Generate "pistil" */ /* Polygon/ellipse/text plots */ proc sgplot data=flower aspect=1 noborder noautolegend; polygon x=x y=y id=id / fill fillattrs=(color=cxb19cd9); ellipseparm semimajor=.35 semiminor=.35 / xorigin=0 yorigin=0 fillattrs=(color=cxfadadd) nooutline; text x=x2 y=y2 text=mom / textattrs=(color=white size=28pt color=purple); xaxis display=none min=-1 max=1 offsetmin=0 offsetmax=0; yaxis display=none min=-1 max=1 offsetmin=0 offsetmax=0;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 658 views
  • 6 likes
  • 2 in conversation