Many questions about formatting heat maps

7 views (last 30 days)
D
D on 20 Jul 2011
Hello,
First off, this is related to the question I previously posted: http://www.mathworks.co.uk/matlabcentral/answers/11020-caxis-with-heatmap
However, I have additional questions, and I thought it might simply be easier to put them in a list, rather than trying to squeeze them in the comments.
1) As I noted in the comments, after I use the plot method as suggested by Patrick and try to add a title to the figure, different parts of the title end up on different lines.
title(ax, ['Plot ' num2str(p) ': ' list(p)]);
where p is an index for this particular plot (I'm doing these in a loop) and where
list = {'abcd'; 'efgh'}
So, it should read something like: "Plot 1: abcd" and "Plot 2: efgh". Instead I get
Plot
1
:
abcd
2) I'm having problems with some of the shorter labels getting cut off (versus the longer ones). The labels were added using the 'RowLabels' and 'ColumnLabels' options in the HeatMap constructor. Is there a way to force space between the labels and heat map?
EDIT: I suppose I'm just going to add a space after all the labels. But does anyone know why something like this would happen?
3) I have excess grey space around the exported figure, for reasons that are unclear. I can't seem to stretch the "plot area". Is there another way of dealing with this?
4) Is it possible to color diagonal elements an entirely different color, without affecting the colormap scale or colorbar?
EDIT: Regarding Q4:
I think the easiest thing to do would be to add a dummy value for diagonal elements, and create a secondary colormap with just this value. I don't want to add it to the current colormap, because I am rescaling the colormap to be on a fixed scale (for comparing multiple heat maps). Is there an easy way to do this, without affecting the entire heat map?
EDIT 2: I managed this by redefining the colormap, with black at the bottom. I then rescaled the colormap using caxis, and then changed the scale of the colorbar by setting the y limits.
If anyone could answer any part of these questions, I'd be very grateful.
Thanks.

Answers (1)

Robert Cumming
Robert Cumming on 20 Jul 2011
Q1:
title(ax, ['Plot ' num2str(p) ': ' list{p}]); % note curly brackets to access the p element of your list.
I dont have the toolbox you mention so cant investigate the others
But guessing: Can you access the axes - if so you might be able to set the "position" element of it to remove grey space. Have a look at the propertys of the "diagonal elements" to see if you can change the color.
  1 Comment
D
D on 20 Jul 2011
The curly brackets helped!
I am playing around with the position, but no luck with accessing properties of the diagonal elements.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!