Graphics Previous page   Next Page

Adding a Colorbar to a Graph

Colorbars display the current colormap and indicate the mapping from data values to colors. The following picture shows a surface plot with 2-D contour lines below. Note how the colorbar at the right indicates how the z-axis data values correspond to colors in both the surface and contour graphs.

Add a colorbar by clicking the colorbar icon in the toolbar or by selecting Colorbar from the Insert menu. When plot editing is enabled, you can select and then move and resize the colorbar.

You can also use the colorbar command to add a colorbar to a graph.

Positioning Options for Colorbars

There are a variety of ways to reposition a colorbar in the figure.

Selecting a Different Colormap

If you change the figure colormap, the colorbar updates automatically. Use one of the following methods to change the colormap.

Modifying the Colormap

You can use a colorbar to modify the current colormap. To do this, select Interactive Colormap Shift from the right-click context menu. In this mode, you can left-click down on any color in the colorbar and, by dragging the mouse, shift the color-to-data mapping.

To perform more sophisticated operations on the colormap, launch the colormap editor by selecting Launch Colormap Editor from the colorbar's context menu. See the colormapeditor reference page for more information.


Previous page  Annotation Lines and Arrows Adding a Legend to a Graph Next page

© 1994-2005 The MathWorks, Inc.