Data visualization with SAS programming

HOW DO I assign different colors to transparent bands in SGPLOT?

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

HOW DO I assign different colors to transparent bands in SGPLOT?

Hello,

Could you please help with the following issue?

I am plotting series and bands by group on the same graph.

The bands are automatically distinct by color when I use the default opaque.

When I add the transparency option the groups are no longer distinct by color. How can I assign distinct colors to the bands of the groups?

Thank you very much for your help.

 

proc sgplot data=dataset;
title "test";
series x=level y=mean_var / group = diabetes;
band x=level upper=p75_var
lower=p25_var / fillattrs=(transparency=0.5)  group = diabetes ;
run;


Accepted Solutions
Solution
4 weeks ago
SAS Super FREQ
Posts: 3,221

Re: HOW DO I assign different colors to transparent bands in SGPLOT?

use

band x=level upper=p75_var lower=p25_var / fillattrs=GraphData(transparency=0.5) group=diabetes ;

View solution in original post


All Replies
Solution
4 weeks ago
SAS Super FREQ
Posts: 3,221

Re: HOW DO I assign different colors to transparent bands in SGPLOT?

use

band x=level upper=p75_var lower=p25_var / fillattrs=GraphData(transparency=0.5) group=diabetes ;

New Contributor
Posts: 2

Re: HOW DO I assign different colors to transparent bands in SGPLOT?

Thank you!
SAS Super FREQ
Posts: 3,221

Re: HOW DO I assign different colors to transparent bands in SGPLOT?

BTW, the more usual syntax is 

band x=level upper=p75_var lower=p25_var / transparency=0.5 group = diabetes ;

 

You put the TRANSPARENCY option inside the FILLATTRS= option, which is what caused your problem.

Post a Question
Discussion Stats
  • 3 replies
  • 87 views
  • 0 likes
  • 2 in conversation