I am potting the curves that represent data from 1970 to 2010 in all the colors starting from blue and ending in red. Next to plot I want the colorbar to appear showing the dates from blue-1970 to red 2010. My code shows only the date from 1970 to 1978. and the color is white only. Help me in getting all the ticks and color in the colorbar.
{
x=1:41;
t=x;
A=colormap(jet(41));
for i=1:41
plot(t(i),x(i),'--rs','MarkerSize',20,'Color',A(i,:));
hold on;
end
dates=1970:2010;
colormap(jet(41));
h=colorbar('YTickLabel',num2str(dates'));
set(h,'YLim',[1970 2010]);
}
Thanks in advance.
0 Comments
Sign in to comment.