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

📢

ANNOUNCEMENT

The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

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.

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
  • 2 replies
  • 675 views
  • 0 likes
  • 2 in conversation