'How to rasterize surface plot while keeping axes as vector graphics in MATLAB?
I am making a 3d surface plot in MATLAB, and I want to rasterize the surface plot (to save image size and loading speed) while keeping the rest of the figure (e.g. axes, labels, titles, etc) as vector graphics. How to do this? Right now I have the following:
x = linspace(-2,2,201);
y = linspace(-2,2,201);
[X,Y] = meshgrid(x,y);
Z = sin(sqrt(X.^2 + Y.^2));
fig = figure;
colormap parula
surf(X,Y,Z,'FaceColor','interp', 'EdgeColor','none', 'FaceLighting','gouraud')
daspect([4 4 1])
axis tight
view(-50,30)
camlight left
exportgraphics(fig,'test_matlab_02.pdf', 'ContentType','vector')
If I set ContentType to vector, then the whole figure is vector graphics. If I set ContentType to image, then the whole figure becomes rasterized. How to have rasterized surface plot with vector graphics for the remaining features in the figure?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
