Henning Frechen
Henning Frechen

Reputation: 55

MATLAB: Bug in plot function

I wrote some code at home to plot some 3D-data. It worked fine. Now I ran the same code at the office and I got some weird bug. It seems that there is a label for each data point inserted.

But this only happens on half of the plots. The left plot shows the real data and the right one is just a smoothed fit of this data. The left one gets the error and the right one doesn't.

I ran the code on the machine of a colleague and it worked fine too. So I saved the clean figure files on his machine and tried to open them on my PC. Still the same bug. So it's not the code but seems to be some weird displaying bug. Did anyone see this before? Numbers in Plot

figure(1);
s1=gca;
surf(t_matrix,f_matrix,alpha_matrix)
colorbar
figure(2);
s2=gca;
surf(t_matrix2,f_matrix2,alpha_matrix2)
colorbar

It's just this code. And if I debug, the numbers appear after the first call to colorbar. But not in the second case. My Matlab version at home is 2013a, but at the office and that from my colleague are both 2012b.

Upvotes: 0

Views: 1086

Answers (2)

Oliv
Oliv

Reputation: 1

Actually the zbuffer renderer works fine but is not enough in some cases.

I often use to work with transparent surface plot using the gca property facealpha set to 0.5 in order to superpose a contour plot to it. Face or edge alpha settings (maybe some other plot properties) are only correctly displayed with the Opengl renderer. The zbuffer cannot picture transparent surface plot.

The main issue first came to my attention when I recently switched to Win8. Bloody $Bill 'HamsterWhy' Gate.

A patch from Mathworks would be greatly appreciated.

Upvotes: 0

HebeleHododo
HebeleHododo

Reputation: 3640

This seems to be a bug. There is a thread on MATLAB Answers.

The accepted answer there by Jan Simon is

This could be cause by the OpenGL driver. Did you install the newest drivers of your graphics cards?

Workaround might be:

set(gcf, 'renderer', 'zbuffer');

or if OpenGL looks nicer:

opengl software

or perhaps:

opengl hardware

Look for "OpenGL" in the documentation to find a bunch of switches to consider a bunch of driver bugs.

Upvotes: 5

Related Questions