Why does the FIGURE command create two figures when I set the colormap property in MATLAB 7.3 (R2006b)?

2 views (last 30 days)
I am creating a figure using the FIGURE command in MATLAB 7.3 (R2006b). When I set the 'Colormap' property of the figure to "gray" using the following statement:
h = figure('Colormap',gray);
two figures are generated instead of one.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Jul 2015
This behavior is expected, and is due to the following:
If there are no input arguments to GRAY, the colormap property value 'gray' will call GCF to get the default Colormap length, and this will create the new figure.
As a workaround, specify the colormap length in the command as follows:
h = figure('Colormap',gray(256));

More Answers (0)

Categories

Find more on Colormaps in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2006b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!