Specified color bar in Matlab?

I am trying to create a shape in Matlab that is suitable for publishing, and I need help with colorbar.

My data ranges from -20 to 30, but I want the color bar to focus on -15 to 15, with arrows at each end to represent values โ€‹โ€‹outside this range.

I tried using the "pointyColorbar" class ( http://www.mathworks.co.uk/matlabcentral/answers/48773 ), but it does not produce the required output. Ideally, I would like the color bar to look like the one below, but using my custom color map.

Can anyone help me with this? Sorry if I didnโ€™t ask the question correctly - I am new to this!

enter image description here

As requested, below is what I have in my color bar (cmap is my custom color map):

cmap=precipanomcolourmap(7,7) colormap(cmap) caxis([-20 30]) cb=colorbar('location','southoutside'); set(get(cb,'title'),'string','Average annual precipitation anomaly (%)','FontWeight','bold'); set(cb,'XTick',[-17.5 -15 -12.5 -10 -7.5 -5 -2.5 0 2.5 5 7.5 10 12.5 15 17.5]); xlim(cb,[-17.5 17.5]); 

This gives me a rectangular color bar below my figure from -17.5 to 17.5. Values โ€‹โ€‹outside this are marked using the same color as the range +/- 15-17.5.

When I tried the pointyColorbar class, I replaced the line cb=colorbar('location','southoutside'); on cb=pointyColorbar(15,-15,'location','southoutside') . It is possible that I need to play around with how to use the pointyColorbar class, but I donโ€™t understand the code enough to find out how to make it look the way I want it.

+6
source share
1 answer

Regarding the pit problem, I think your answer is at the bottom of this page:

http://www.mathworks.com/matlabcentral/answers/48773

and about the colorbar borders, I think you are looking for something like:

set (gca, 'CLim', [cLow, cHigh]);

before you lay out the color panel.

('cLow' and 'cHigh' are the limits you want for the color bar).

Take a look at this: http://www.mathworks.com/matlabcentral/newsreader/view_thread/163344

0
source

All Articles