Hello,
I am using sgplot to do 2 histograms in a figure, comparing the distribution of 2 groups (one in blue, one in red). I chose to keep the histogram bars empty (nofill option). The legend therefore shows only a colored line, one red and one blue. I would however like to have boxes in the legend, not lines. To match the appearance of my histogram bars, I would like to therefore have empty/white boxes, with colored outlines matching my groups. I can't seem to figure out how to do this. I can either have just lines, or fully colored red and blue boxes. Any experience/ideas with that? Thanks a lot!
The way to do that is to set the FILLATTRS color to be the same color as the wall (white, for example) instead of turning the fill off. That way, the legend treats the representation as if it was filled, giving you the box. Let me know if this works for you.
Thanks!
Dan
The way to do that is to set the FILLATTRS color to be the same color as the wall (white, for example) instead of turning the fill off. That way, the legend treats the representation as if it was filled, giving you the box. Let me know if this works for you.
Thanks!
Dan
For the record, there is another way to do this that might even be more desirable. Instead of specifying the COLOR in FILLATTRS to the background color, just set TRANSPARENCY=1 in the FILLATTRS. That way, you will get the correct appearance regardless of the ODS style you use.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.