BookmarkSubscribeRSS Feed
chang_y_chung_hotmail_com
Obsidian | Level 7
Is it possible to draw lines with different transparency levels (based on a variable)? For instance, I would like to do something like below, but I get an error because transparency= option does not take a variable. 😞



Unlike the example, I have about 400 lines to overlay and I thought varying the transparency is a way to avoid over-plotting and to emphasize series based on some measure of importance (i.e., the more "important" the series is, the lower its transparency level). Maybe I am thinking about this incorrectly. Any idea to achieve similar results will be appreciated.



  /* test data */

   %let seed = 1234;

   data one;

     do id = 1 to 4;

       trans = 0.9 + 0.02 * id;

       do day = 0 to 10;

         price = 0.2 *ranuni(&seed);

         output;

       end;

     end;

   run;

 

   ods graphics on;

   ods html;

      proc sgplot data=one;

        series x=day y=price / group=id transparency=trans;

      run;

   ods html close;
2 REPLIES 2
DanH_sas
SAS Super FREQ
Hey Chang,

The procedure does not support variable transparency; however, I do not think you would get the result you expect anyway. With that many lines, the varying transparencies would probably be lost in accumulation effect of overlaying transparent features (some areas would get more and more opaque). Some people use this effect on scatter plots to see where points cluster in the plot or on series plots to see general trends. What are you trying to accomplish with your plot?

Thanks,
Dan
chang_y_chung_hotmail_com
Obsidian | Level 7
@Dan:H
You are right. I think I over-thought. I probably don't need variable transparency. Overlaying (a constant level of) transparent features should take care of accentuating the overall patterns, if any. Thanks.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1161 views
  • 0 likes
  • 2 in conversation