Very weird bug(?) on latex interpreter

I include a code snippet which colors underneath a sine curve. There is a ylabel with the latex interpreter turned on. Changing the number of patches (from N = 100 to N = 1000) seems to affect the resolution of the axis label. Does anybody know what's going on? Please see the images below for the good label and the messed up one:
The code is
figure(1);
clf(1);
N = 100;
x = linspace(0, 2*pi, N);
f = sin(x);
g = 0*f;
verts = [x(:), f(:); x(:) g(:)];
q = (1:N-1)';
faces = [q, q+1, q+N+1, q+N];
p = patch('Faces', faces, 'Vertices', verts, ...
'FaceVertexCData', [f(:); f(:)], ...
'FaceColor', 'interp', 'EdgeColor', 'none');
ylabel(['$N = ' num2str(N) '$'], 'FontSize', 18, 'interpreter', 'latex');

 Réponse acceptée

Jan
Jan le 10 Nov 2011
This is a problem with your OpenGL-driver. For large data sets the renderer is automatically set to OpenGL, but with Painters the graphics are ok. If you set the renderer manually, it is not changed automatically:
figure('Renderer', 'Painters');
...
The problems for OpenGL might be solved by updating the driver of the graphics card, or by using a software renderer:
opengl software
For more details see help opengl.

3 commentaires

Theo
Theo le 10 Nov 2011
The painters renderer does not seem to fix the end result in the sense that any outputted figures still have a bad ylabel. If you add to the code I wrote in the first post with the line "set(gcf, 'Renderer', 'Painters')", the figure in the output window is fine, but once you output with "print('-dpng', 'test.png')" you'll see that the ylabel does not render.
Do print commands automatically use OpenGL?
Titus Edelhofer
Titus Edelhofer le 10 Nov 2011
Try to add parameter "-painters" while printing.
Theo
Theo le 10 Nov 2011
Yes, Titus, this does the trick. It is a somewhat unsatisfactory workaround (as painters graphics might not suffice), but I'll accept it. Thanks all.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by