Skip to content
Shane Rosanbalm edited this page Mar 10, 2017 · 12 revisions

Macro Basics

The simplest application of the %viridis() macro requires only one parameter: n=.

%viridis(n=4)

The result of this call will be a macro variable &viridis4 which contains a space-separated list of colors from the viridis palette.

viridis4 = cx440154 cx30688E cx35B779 cxFEE724

Grouped Data

If you're using SAS v9.2 you'll use &viridis4 in the colors= parameter of the %modstyle() macro. If you're using SAS v9.3 or higher you can use &viridis4 in the datacontrastcolors= argument of the styleattrs statement.

%viridis(n=4);

proc sgplot;
   styleattrs datacontrastcolors=(&viridis4);
   series ...
run;

viridis sgplot

Color Response Data

The macro can also be used for color response plots. For instance, with the colormodel= argument on the heatmap statement.

%viridis
   (n=256
   ,palette=plasma
   ,result=myramp
   );

proc sgplot data=plotdata;
   heatmap x=x y=y / colormodel=(&myramp);
run;

plasma sgplot

Pretty, oh so pretty!

Clone this wiki locally