Error using surf() with colorbar and title

1 回表示 (過去 30 日間)
Christian Jensen
Christian Jensen 2013 年 4 月 1 日
編集済み: Sven 2013 年 12 月 11 日
I am plotting a 2D matrix with the surf command followed by the colorbar and title command. When I do, I get this:
figure,surf(magic(99)),colorbar,title('Va')
I can mend this by setting
set(gcf,'Renderer', 'zbuffer')
But why!?
The problem also disappears when I save it as .png. Then I get:
Can anyone tell me what's happening? I'm using version R2012b 64 bit on Windows 8.
Thanks :)
  1 件のコメント
Samuel
Samuel 2013 年 12 月 10 日
Hi,
I can't say I know why it happens. I just wanted to thank you for the solution. I was having the same issue.
Sam

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

回答 (1 件)

Sven
Sven 2013 年 12 月 11 日
編集済み: Sven 2013 年 12 月 11 日
Hi Christian, try this:
opengl('software')
figure,surf(magic(99)),colorbar,title('Va')
Does that sort it out as well?
If so, then I think the most probable explanation you'll hear is "it's a graphics driver problem". To me, this is universal programmer's language for "it's a weird bug that nobody can track down but there's a solution for it so nobody needs to".
:)
There are a few bug reports for various graphy issues that suggest this solution, but none of them give much illumination on the root cause.
The 'software' opengl is sometimes better than using the 'zbuffer' renderer, because zbuffer will not allow for transparent objects in your figure.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by