Custom colorbar labeling centered on colors
I have a figure for which I want to create custom colorbar labeling. Below is the sample code:
figure;
set(gca,’xtick’,[],’xticklabel’,[],’ytick’,[],’yticklabel’,[],’color’,’w’);
set(gcf,’units’,’pixel’,’position’,[70,70,600,600],’papersize’,[600,600],’color’,’w’);
ax=gca;
colormap(flipud(jet(11)));
caxis([0 11]);
hcb=colorbar(‘SouthOutside’);
axPos = ax.Position;
colorbarpos=hcb.Position;
hcb.Ruler.TickLabelRotation=0;
set(hcb,’YTick’,[0:1:11],’TickLength’,colorbarpos(4)/colorbarpos(3));
This gives a standard southoutside, reverse jet colorbar like below:
Instead, I’d like to create custom labels centered on each color…something like below:
Any ideas on how or if this can be done?I have a figure for which I want to create custom colorbar labeling. Below is the sample code:
figure;
set(gca,’xtick’,[],’xticklabel’,[],’ytick’,[],’yticklabel’,[],’color’,’w’);
set(gcf,’units’,’pixel’,’position’,[70,70,600,600],’papersize’,[600,600],’color’,’w’);
ax=gca;
colormap(flipud(jet(11)));
caxis([0 11]);
hcb=colorbar(‘SouthOutside’);
axPos = ax.Position;
colorbarpos=hcb.Position;
hcb.Ruler.TickLabelRotation=0;
set(hcb,’YTick’,[0:1:11],’TickLength’,colorbarpos(4)/colorbarpos(3));
This gives a standard southoutside, reverse jet colorbar like below:
Instead, I’d like to create custom labels centered on each color…something like below:
Any ideas on how or if this can be done? I have a figure for which I want to create custom colorbar labeling. Below is the sample code:
figure;
set(gca,’xtick’,[],’xticklabel’,[],’ytick’,[],’yticklabel’,[],’color’,’w’);
set(gcf,’units’,’pixel’,’position’,[70,70,600,600],’papersize’,[600,600],’color’,’w’);
ax=gca;
colormap(flipud(jet(11)));
caxis([0 11]);
hcb=colorbar(‘SouthOutside’);
axPos = ax.Position;
colorbarpos=hcb.Position;
hcb.Ruler.TickLabelRotation=0;
set(hcb,’YTick’,[0:1:11],’TickLength’,colorbarpos(4)/colorbarpos(3));
This gives a standard southoutside, reverse jet colorbar like below:
Instead, I’d like to create custom labels centered on each color…something like below:
Any ideas on how or if this can be done? colorbar, custom, colormap MATLAB Answers — New Questions