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?
@GraphGuy might give you an answer .
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
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.