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-2024.png

 

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

 

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 

 

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.

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
  • 3 replies
  • 367 views
  • 0 likes
  • 3 in conversation