Function 'print' does not save properly in 'png' format. Title of the colorbar in a surf plot is missing (Matlab2015b on Mac OSX 10.9.5)

4 ビュー (過去 30 日間)
Luca
Luca 2015 年 12 月 15 日
編集済み: Luca 2015 年 12 月 18 日
This code creates a figure to be exported/saved:
[X,Y,Z] = peaks(25);
hf = figure;
surf(X,Y,Z);
view(2)
cb = colorbar
set(get(cb,'title'),'string','MyTitle','fontsize',16)
On screen you should see this figure:
When the figure is saved using the command print, the title of the colorbar is missing. In fact, the following code
print(hf,'-dpng','-r300','MyFigure');
creates the figure 'MyFigure.png' that looks like:
The problem is experienced on:
  • Matlab2015b
  • Mac OSX 10.9.5
Any ideas, suggestions or solutions are welcome.
Luca
EDIT
The same code on a machine with Windows 10 works.
Maybe it is a bug only for Mac OS X systems.

回答 (1 件)

Shruti Sapre
Shruti Sapre 2015 年 12 月 17 日
Hi,
I tried the above code and it displayed the title for me. You could maybe try switching to a basic version of hardware-accelerated OpenGL or update your drivers
-Shruti
  1 件のコメント
Luca
Luca 2015 年 12 月 18 日
Hi Shruti Sapre, thanks for the try. By the way, I tried to switch to basic version of hardware-accelerated OpenGL and it does not solve.
It seems to me that this is a bug for operating system OS X. Because O tested the code on a Win10 machine with Matlab2015b and the code works. (I'm going to edit the question with this information).
On which operating system did you try the code?

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by