Why does the FIGURE command create two figures when I set the colormap property in MATLAB 7.3 (R2006b)?
2 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Edited: MathWorks Support Team
on 22 Jul 2015
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
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));
0 Comments
More Answers (0)
See Also
Categories
Find more on Colormaps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!