I want to change the color ramp of my heatmap plot. I make a heatmap plot using a graphical template language. My response variable is in percentage form. So, I want to make the colormodel represent the value between 0 to 100 percent, blue color for low percentage (0% to 10%), white color for 10% to 20%, and red color for more than 20%. But my response variable (colorresponse) is range between 0 to around 20 percent, which caused different output from what I want. The color range follow the response variable's range (0 to 20%). Here is the code I've tried.
proc template;
define statgraph training;
begingraph /DESIGNHEIGHT=550px DESIGNWIDTH=650px;
entrytitle 'Heatmap of Digit Check';
layout overlay /yaxisopts=(label="Date" tickvalueattrs=(size=8pt)) xaxisopts=(label="Last Digit" tickvalueattrs=(size=8pt));
heatmapparm y=day x=ld colorresponse=percent / display=all name='percent' colormodel=(blue white red);
scatterplot x=sbp_ld y=day /markercharacter=percent markercharacterattrs=(size=8);
continuouslegend 'percent';
endlayout;
endgraph;
end;
run;
proc sgrender data=digit_check template=training;
run;
Here is the result.
Could anyone help me on this? Thank you for any help you can offer.
Regards,
Mifta
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.