Color bar for filled contour map display
H = contourcbar(...)
H = contourcbar(...) creates a color bar
associated with a filled contour display created with
It supports the same syntax and usage options as the MATLAB® function
Create world map.
figure('Color','white') worldmap('north america')
Load topographical data from MAT-file
Create geographic raster reference object.
R = georasterref('RasterSize',[180 360], ... 'Latlim',topolatlim,'Lonlim',topolonlim);
Create a contour plot where every contour is filled with a particular color.
contourfm(topo, R, -7000:1000:3000) caxis([-8000 4000])
Add a color bar to the figure to explain the color used with the contours.
Create a world map.
figure('Color','white') ax = worldmap('world');
Move the meridian labels to the bottom, and reduce the number of labels.
Load the geoid data set MAT-file.
Specify levels (in meters) at which to contour the geoid.
levels = [-70 -40 -20 -10 0 10 20 40 70];
Display the geoid as a filled contour plot.
geoshow(geoid60c, geoid60cR, 'DisplayType', 'contour',... 'LevelList',levels,'Fill','on','LineColor','black')
Load the coastline data MAT file,
Overlay the coastlines.
geoshow(coastlat, coastlon, 'Color', 'white', 'LineWidth', 1.5)
Add a color bar to indicate the range in geoid height spanned by each contour interval.
cb = contourcbar('peer',ax,'Location','southoutside');
Reset the color map and the axes color limits (CLim).
caxis([-110 90]) colormap(hsv) cb.XLabel.String = 'Geoid Undulation in Meters';
If a peer axes is specified when
contourcbar, it should be a map axes containing
an object created using one of the Mapping
Toolbox™ functions listed
previously. Otherwise the current axes should contain such an object.
If a Mapping Toolbox contour object is present, then the color bar is filled with solid blocks of color which bound each other at the contour levels used in the plot. Thus, the contour levels bounding a fill polygon of a given color can be inferred graphically by inspecting the upper and lower limits of the corresponding block in the color bar. In the absence of a Mapping Toolbox contour object an ordinary color bar is created.
If multiple Mapping Toolbox contour objects are present in the same axes, then the levels used to divide the color bar into blocks will correspond to the first contour object that is found. This situation could occur when a larger data set is broken up into multiple grid tiles, for example, but as long the tiles all use the same contour level list, the color bar will correctly represent them all.