BookmarkSubscribeRSS Feed
WJJK
Calcite | Level 5

I know how to make a polygon in an annotation data set (with sgpolygon and sgpolycont). I know how to set the line color, the line pattern, the fill color, but is there a way to fill the polygon with a pattern?

3 REPLIES 3
Ksharp
Super User

@GraphGuy  might give you an answer .

RichardDeVen
Barite | Level 11

Can you show some code ?
Are you creating raw annotate data (DIY) or using %SG*** macros ?

At present there is no built-in way to render a polygonally clipped image or have a polygon FILLSTYLEELEMENT other than COLOR. You can suggest new feature s at the SASWare Ballot

  • annotate with an image that is polygon clipped, tiled, stretched or fit to target area
  • annotate with fill style elements such as pattern and hatch as was possible with DSGI
WJJK
Calcite | Level 5

Thank you for your reply. I plot a graph of observations on the y-axis and time on the x-axis in sgplot with the series statement. I then want to fill the area below the graph with a pattern. This could of course be done with a band statement, but I want to achieve a kind of zig-zag pattern; lines of the pattern go up from Time 1 to Time 2, down from Time 2 to Time3, up from Time 3 to Time. I didnt's see an easy way with the band statement, so I thouth to give it a try with annotating. I am programming the annotate data set from scratch (so not using the macros). Instead of a pattern, I now use alternating colors. This is the code:

 

function = "polygon";
x1 = Time1;
y1 = 0;
if mod(_N_, 2) = 0 then do;
   fillcolor = "cx3B5DAD";
end;
else do;
   fillcolor = "cx393547";
end;
filltransparency = 0.5;
display = "fill";
layer = "back";
x1space = "datavalue";
y1space = "datavalue";
output;

function = "polycont";
x1 = Time2;
y1 = 0;
output;

function = "polycont";
x1 = Time2;
y1 = Obs2;
output;

if _N_ > 1 then do;
function = "polycont";
x1 = Time1;
y1 = Obs1;
output;
end;

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 829 views
  • 0 likes
  • 3 in conversation