One way to do this is to use the heatmap
function in combination with the colormap
function in MATLAB. Here's an example code:
main.m565 chars15 lines
The diverging_map
function is a custom function to create a colormap that goes from blue (positive values) to red (negative values). Here's the code for that function as well:
main.m330 chars19 lines
This should create a heatmap with positive and negative values where positive values are blue and negative values are red, and the color of each cell graduates based on the pvalue.
gistlibby LogSnag