Graphics    

Nonactive Figures and Shared Colors

Overview

Set ShareColors to on to conserve resources and to off to allow rapid colormap change.

More Detail

Since nonactive figures are still visible, it is generally desirable for them to display correctly colored. However, if a number of figures with different colormaps exist simultaneously, or have large colormaps, the computer's color resources may not be able to display all figures correctly colored. When ShareColors is on, the figure does not redefine a color in the system color table if that color already exists.

While sharing colors is a more efficient use of resources, it prevents MATLAB from rapidly changing the colormap (for example, as the spinmap function does). This is because MATLAB cannot change the value of a color slot in the system color table if other pixels also point to that slot for their color definition. It must find another slot for the new color. Changing color slot pixel assignments requires rerendering (i.e., recomputing color values and reassigning pixels to these colors) of the figure whose colormap you are altering.

If you want to change a figure's colormap rapidly, you should disable color sharing.

Note that the new colormap must be the same size as the original one to avoid rerendering the figure. Look at the spinmap M-file for an example of this technique.


  Using a Large Number of Colors Dithering Truecolor on Indexed Color Systems