I created a pcolor image with each grid shaded in based on a value in the matrix C
.
h1 = pcolor(C);
colormap(jet)
h = colorbar;
ylabel(h,'Monthly Correlation (r-value)');
shading flat
Each grid corresponds to a particular year on the x axes and a particular site name on the y axes. How can I add an axes label to show this?
I tried the following but it didn't do anything. Plus, I'd like to put the label in the middle of each grid, not on the edges.
set(h1,'XTick',years')
set(h1,'YTick',a)
x axes labels: years'
looks like this (size 15×1 double)
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
y axes labels: a
looks like this (12×1 cell):
'09-003-1003-88101'
'09-009-0027-88101'
'25-013-0008-88101'
'25-025-0042-88101'
'33-005-0007-88101'
'33-009-0010-88101'
'33-011-5001-88101'
'33-015-0014-88101'
'33-015-0018-88101'
'44-003-0002-88101'
'44-007-1010-88101'
'44-009-0007-88101'
Current image looks like this:
Best Answer
You are using the wrong handle. For setting labels you need the axes handle and not the
pcolor
-handle:Example: