-
Notifications
You must be signed in to change notification settings - Fork 2
Home
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
If you're using SAS v9.4 you can use &viridis4
in the datacontrastcolors=
argument of the styleattrs
statement.
%viridis(n=4);
proc sgplot;
styleattrs datacontrastcolors=(&viridis4);
series ...
run;
If you're using an earlier version of SAS you can use &viridis4
in the colors=
parameter of the %modstyle()
macro. There's also a one-record-per-color dataset (work.palette
) that is generated. You could use this to build a discrete attribute map.
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=mycolormodel
);
proc sgplot data=plotdata;
heatmap x=x y=y / colormodel=(&mycolormodel);
run;
Pretty, oh so pretty!
The macro has other options such as reverse
and greyscale
. Check out the macro header for more details.