Sometimes, it can help to change Matlab's figure renderer, which is basically the backend that performs the drawing. Options are painters
, zbuffer
, and OpenGL
.
Since it is a figure property, you can apply it to a specific figure, e.g.:
set(gcf(), 'Renderer', 'painters')
or update the default figure properties (if always needed, you could put it in your user-specific startup.m):
set(0, 'Renderer', 'painters')
Similarly, to get the current Renderer state, use get
instead of set
:
get(gcf(), 'Renderer')
Different renderers have different performance properties (e.g. OpenGL
renderer can use hardware acceleration, if supported), but also different quirks (in my experience, frame capturing using getframe() works with some renderers while using remote desktop login, but not all). While I don't know the exact reason for your problem, it may be one of these weird quirks, so try changing the renderer.
From the Renderer property documentation:
Rendering method used for screen and printing.
Selects the method used to render MATLAB graphics. The choices are:
painters
— The original rendering method used by MATLAB is faster when the figure contains only simple or small graphics objects.
zbuffer
— MATLAB draws graphics objects faster and more accurately because it colors objects on a per-pixel basis and MATLAB renders only those pixels that are visible in the scene (thus eliminating front-to-back sorting errors). Note that this method can consume a lot of system memory if MATLAB is displaying a complex scene.
OpenGL
— OpenGL is a renderer that is available on many computer systems. This renderer is generally faster than painters or zbuffer and in some cases enables MATLAB to access graphics hardware that is available on some systems.
painters
,zbuffer
,OpenGL
): mathworks.nl/help/techdoc/ref/figure_props.html – Flattop