Painters renderer results in jagged edges

3 visualizaciones (últimos 30 días)
Rushikesh Kamalapurkar
Rushikesh Kamalapurkar el 28 de En. de 2020
Respondida: J. Alex Lee el 29 de En. de 2020
I am trying to generate a vector graphics file from a surface plot.
[X,Y] = meshgrid(-1.5:0.1:1.5,-1.5:0.1:1.5);
Z = (abs(X).*(abs(X) > abs(Y)) + abs(Y).*(abs(X) <= abs(Y))).*...
((abs(X) < 1) & (abs(Y) < 1)) + 1.*((abs(X)>=1) | (abs(Y)>=1)) + ...
max(2*X-2,0)-min(2*X+2,0)+max(2*Y-2,0)-min(2*Y+2,0);
fig=figure;
surf(X,Y,Z);
view(gca,[-65 10]);
This results is the plot that I want.
If I switch to Painters in order to save the figure as a vector graphics file, I get jagged edges:
fig.Renderer='Painters';
Any ideas how I can fix this?

Respuesta aceptada

J. Alex Lee
J. Alex Lee el 29 de En. de 2020
What happens if you set "FaceColor" to "interp" (default is "flat") on the surf object? It fixes the jagge edge for me (2017a or b on mac)
[X,Y] = meshgrid(-1.5:0.1:1.5,-1.5:0.1:1.5);
Z = (abs(X).*(abs(X) > abs(Y)) + abs(Y).*(abs(X) <= abs(Y))).*...
((abs(X) < 1) & (abs(Y) < 1)) + 1.*((abs(X)>=1) | (abs(Y)>=1)) + ...
max(2*X-2,0)-min(2*X+2,0)+max(2*Y-2,0)-min(2*Y+2,0);
fig=figure;
s = surf(X,Y,Z);
view(gca,[-65 10]);
s.FaceColor = 'interp'

Más respuestas (0)

Categorías

Más información sobre Functions en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by