Earthrise (Bubble/Ellipse Plot)
Earthrise (Apollo 11)
Figured I should do something to mark the 50th anniversary of the Moon Landing, even if it's only a silly Earthrise bubble/ellipse plot!
* Fun w/SAS ODS Graphics: Apollo 11 Earthrise Bubble/Ellipse Plot
See the real Apollo 11 deal at history.nasa.gov/ap11ann/kippsphotos/6550.jpg;
ods graphics / height=5in width=5in antialias; * Original NASA image was 600 x 600;
data moon; * Generate a point for the earth;
x=300; y=185; r=50; * x, y, radius for bubble plot of "earth";
proc template; * "Earth Rise" chart (bubble + eclipse plot);
define statgraph ellipseparm;
begingraph / opaque=true border=false backgroundcolor=black pad=0 subpixel=on; * Black background;
layout overlayequated /
equatetype=square opaque=true border=true backgroundcolor=black wallcolor=black WALLDISPLAY=(FILL)
commonaxisopts=(viewmin=0 viewmax=600) /* Limit X-Y axes range to 0=600 */
xaxisopts=(display=none offsetmin=0 offsetmax=0)
yaxisopts=(display=none offsetmin=0 offsetmax=0 reverse=true); * Got coordinates from MS-Paintbrush, so use reverse y-axis;
bubbleplot x=x y=y size=r /
fillattrs=(color=dodgerblue) display=(fill) dataskin=sheen relativescale=false; * Dodger Blue Earth;
ellipseparm xorigin=300 yorigin=6250 semimajor=6000 semiminor=6000 slope=0 /
display=(fill) fillattrs=(color=cx696969); * Dim Gray Moon (semimajor=semiminor=circle);
endlayout;
endGraph;
end;
run;
proc sgrender data=moon template=ellipseparm;
Nice. How about adding some textures using images?
Good idea - haven't tried this technique, but will look into it. In the meantime, I borrowed from your 2017 solar eclipse post and added some "stars" with a scatter plot. Also tossed in some random "craters" with a bubble plot.
Earthrise (now with scatterplot stars and bubbleplot craters!)
* Fun w/SAS ODS Graphics: Apollo 11 Earthrise Bubble/Ellipse Plot
See the real Apollo 11 deal at history.nasa.gov/ap11ann/kippsphotos/6550.jpg;
ods graphics / height=5in width=5in antialias dataskinmax=2000; * Original NASA image was 600 x 600;
data earth; * Generate a point for the earth;
x=300; y=185; r=50; * x, y, radius for bubble plot of "earth";
data stars; * Generate random "stars";
do i=1 to 1000;
xs=ceil(ranuni(1)*600);
ys=ceil(ranuni(1)*600);
output;
end;
data craters; * Generate 35 random non-overlapping "craters";
array x[500] _temporary_; array y[500] _temporary_; array r[500] _temporary_;
nc=0;
do i=1 to 500;
xc=30+ceil(ranuni(2)*540); * X-coordinate from 30-570;
yc=280+ceil(ranuni(2)*290); * y-coordinate from 280-570;
rc=10+ceil(ranuni(2)*20); * radius from 10-30;
do j=1 to nc; * Reject new crater if not at least 15 units away from prior craters;
if sqrt((xc-x[j])**2+(yc-y[j])**2)<rc+r[j]+15 then goto rejected;
end;
nc+1; x[nc]=xc; y[nc]=yc; r[nc]=rc; output; * Save crater points, radius;
if nc=35 then stop; * Limit to 35 craters;
rejected:
end;
data earthstarscraters; * Merge data together for chart;
set earth stars craters;
proc template; * "Earth Rise" chart (bubble + eclipse plot);
define statgraph ellipseparm;
begingraph / opaque=true border=false backgroundcolor=black pad=0 subpixel=on; * Black background;
layout overlayequated /
equatetype=square opaque=true border=true backgroundcolor=black wallcolor=black WALLDISPLAY=(FILL)
commonaxisopts=(viewmin=0 viewmax=600) /* Limit X-Y axes range to 0=600 */
xaxisopts=(display=none offsetmin=0 offsetmax=0)
yaxisopts=(display=none offsetmin=0 offsetmax=0 reverse=true); * Got coordinates from MS-Paintbrush, so use reverse y-axis;
scatterplot x=xs y=ys / markerattrs=(symbol=diamondfilled color=white size=2pt); * Stars;
bubbleplot x=x y=y size=r /
fillattrs=(color=dodgerblue) display=(fill) dataskin=sheen relativescale=false; * Dodger Blue Earth;
ellipseparm xorigin=300 yorigin=6250 semimajor=6000 semiminor=6000 slope=0 /
display=(fill) fillattrs=(color=cx696969); * Dim Gray Moon (semimajor=semiminor=circle);
bubbleplot x=xc y=yc size=rc /
fillattrs=(color=cx696969) display=(fill) dataskin=crisp relativescale=false; * Dim Gray craters w/crisp dataskin;
endlayout;
endGraph;
end;
run;
proc sgrender data=earthstarscraters(obs=max) template=ellipseparm;
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.
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.