-1

I have compiled a heat map with the following code:

compounds=uiimport('matrix.txt');
names=uiimport('names.txt');
stages=['Stage ' '3';'Stage ' '6';'Stage ' '9';];
imagesc(compounds.matrix);
colorbar;
colormap('winter');
title('Heat map of ...')
ylabel('Compounds');
xlabel('Developmental stage');
set(gca,'YTick',1:21,'YTickLabel',names.names)
set(gca,'XTick',1:3,'XTickLabel',stages)

Everything works fine and i do not want to change the code as it comes from uplading my data, however i cannot figure out how to add a code (or should i say what kind of code) that would adjust my heatmap colors at a particular scale numbers. What i would like, is for it to be red to green (0 to 10), with a value 1 as black. Additionally, my scale is 0 to 100, but i would like the scale to be visible from 1 to 10 and then have a gap and see just 100 at the top.

Many thanks in advance.

1 Answers1

0

There isn't a language requirement listed here, but can I assume you are using matplotlib or matlab.

You can specify the first part of your request by doing breaks. Setting certain ranges. They have a good explanation here

Color a heatmap in Python/Matplotlib according to requirement

A more technical method is to actually create your own colormap

colors = [('white')] + [(cm.jet(i)) for i in xrange(1,256)]
new_map = matplotlib.colors.LinearSegmentedColormap.from_list('new_map', colors, N=256)

Here you can specify color for particular ranges in this example white is 0 and the rest is the standard flowing range

Credit: Make reverse diagonals white in heatmap

Community
  • 1
  • 1
user1874538
  • 262
  • 2
  • 15