Copying a nonvisible figure causes images to have weird coloring?

1 回表示 (過去 30 日間)
Qingyang
Qingyang 2012 年 7 月 18 日
So, I have this code that showed the figure resultsf (which has 'visible' set to 'off'). I copy it because I do not wish for it to be deleted when the user closes the figure window.
global resultsf;
f = figure('Name', 'Results');
copyobj(allchild(resultsf), f);
set(f, 'visible', 'on');
However, the problem is that when I display resultsf by itself (by setting 'visible' to 'on'), the images (grayscale) in the figure display perfectly. But, when I use the above code, the images will have have a coloring to them.
  3 件のコメント
Qingyang
Qingyang 2012 年 7 月 18 日
I'm not sure if these links definitely work, but here:
Copied figure: http://g2f.nl/07496u5
Qingyang
Qingyang 2012 年 7 月 18 日
I feel that the images are being colormaped even though I did not specify for them to be.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2012 年 7 月 18 日
colormap is per-figure, and is not a property of any child object of the figure. When you create the Results figure, it is given the default colormap, and unless you specifically change that, any mapped child object will use that default colormap.
You should
set(f, 'Colormap', get(resultsf, 'Colormap'))
  1 件のコメント
Qingyang
Qingyang 2012 年 7 月 18 日
Wow! That worked great! Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by