BookmarkSubscribeRSS Feed
Ksharp
Super User

It is a special Chinese picture . Have fun.

 

 

data have;
pi=constant('pi');

/*plot the left white part*/
id=1;
do i=0.5*pi to 1.5*pi by 0.01;
  x=cos(i);y=sin(i);output;
end;
do i=1.5*pi to 0.5*pi  by -0.01;
  x=0.5*cos(i);y=0.5*sin(i)-0.5;output;
end;
do i=-0.5*pi to 0.5*pi  by 0.01;
  x=0.5*cos(i);y=0.5*sin(i)+0.5;output;
end;

/*plot the right dark part*/
id=2;
do i=0.5*pi to -0.5*pi by -0.01;
  x=cos(i);y=sin(i);output;
end;
do i=1.5*pi to 0.5*pi  by -0.01;
  x=0.5*cos(i);y=0.5*sin(i)-0.5;output;
end;
do i=-0.5*pi to 0.5*pi  by 0.01;
  x=0.5*cos(i);y=0.5*sin(i)+0.5;output;
end;


/*plot the  big circle with dark border*/
id=3;
do i=0 to 2*pi by 0.01;
  x1=cos(i);y1=sin(i);output;
end;


/*plot the bottom little white pie*/
id=4;
do i=0 to 2*pi  by 0.01;
  x2=0.15*cos(i);y2=0.15*sin(i)-0.5;output;
end;

/*plot the top little black pie*/
id=5;
do i=0 to 2*pi  by 0.01;
  x3=0.15*cos(i);y3=0.15*sin(i)+0.5;output;
end;
run;

title ;
proc sgplot data=have aspect=1 noautolegend noborder;
styleattrs datacolors=(white black);
polygon x=x y=y id=id/group=id fill   ; /*plot the left and right part*/
polygon x=x2 y=y2 id=id/ fill fillattrs=(color=white)  ; /*plot the bottom little white pie*/
polygon x=x3 y=y3 id=id/ fill fillattrs=(color=black)  ; /*plot the top little black pie*/
series x=x1 y=y1/lineattrs=(color=black thickness=2); /*plot the  big circle with dark border*/
xaxis display=none;
yaxis display=none;
run;
 

Ksharp.png

6 REPLIES 6
novinosrin
Tourmaline | Level 20

@Ksharp  Very nice. Requesting you to please add some /*comments*/ in the code to help anybody understand. Thank you in advance!

Ksharp
Super User
OK. as your wish. Add some comment.
novinosrin
Tourmaline | Level 20

Thank you so much!!!!!!!!!!!

djrisks
Barite | Level 11

Nice graph!

phoenix_lx
Calcite | Level 5
It is named "Tai Ji" in Chinese
Xin
Fluorite | Level 6 Xin
Fluorite | Level 6

Very nice and fun!

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
  • 1281 views
  • 17 likes
  • 5 in conversation