I have a surface plot I’m trying to do. x is an 11 element vector, y a 300 element vector and z a 300*11 element matrix.
When I try to plot it like this:
surf(x y z)
The surface plot doesn’t show up. The axes are there but there is no surface plot.

However, if for some reason I do a surface plot of a subset of the matrix like this:
surf(x y(1:31) z(1:31,:))
Then it works and the plot shows up.

As soon as I increase the number in the brackets to 32 it stops working. If I change the range from 2:32 then it works, so it’s nothing to do with the data just the size of the matrices.
What’s going on here? How do I fix it?
P.S I’d attach the code but it’s a bit long and complex, and imports .txt files to load into the x and y vectors.
Sometimes, it can help to change Matlab’s figure renderer, which is basically the backend that performs the drawing. Options are
painters,zbuffer, andOpenGL.Since it is a figure property, you can apply it to a specific figure, e.g.:
or update the default figure properties (if always needed, you could put it in your user-specific startup.m):
Similarly, to get the current Renderer state, use
getinstead ofset:Different renderers have different performance properties (e.g.
OpenGLrenderer 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: