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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.