Anti-aliasing with printing a pdf

Hello:
Is there a way to print a pdf without the white lines created by the anti aliasing issues in a surf plot. I realize that this can often be fixed in the pdf viewer, but I would like to address this issue so it doesn't occur to other viewers if these plots are published.
My code:
Center_0 = 50.7;
Center = 50.7;
NaN = 47.6;
X = [-3.5 -2.33, -1.167, 0, 1.167, 2.33, 3.5,...
-3.5, -2.33, -1.167, 0, 1.167, 2.33, 3.5,...
-3.5, -2.33, -1.167, 0, 1.167, 2.33, 3.5,...
-3.5, -2.33, -1.167, 0, 1.167, 2.33, 3.5,...
-3.5, -2.33, -1.167, 0, 1.167, 2.33, 3.5,...
-3.5, -2.33, -1.167, 0, 1.167, 2.33, 3.5,...
-3.5, -2.33, -1.167, 0, 1.167, 2.33, 3.5]/100;
Y = [ 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, ...
2.33, 2.33, 2.33, 2.33, 2.33,2.33,2.33,...
1.167, 1.167, 1.167, 1.167, 1.167,1.167,1.167,...
0, 0, 0, 0, 0, 0, 0,...
-1.167, -1.167, -1.167, -1.167, -1.167, -1.167, -1.167,...
-2.33, -2.33, -2.33, -2.33, -2.33, -2.33, -2.33,...
-3.5,-3.5,-3.5,-3.5,-3.5,-3.5,-3.5,]/100;
Z = [NaN,NaN,NaN,48.6,NaN,NaN,NaN,...
NaN, 48.5, 49.7, 49.8, 49.3, 48.0,NaN,...
NaN,49.7, 50.3, 50.4, 49.9, 48.7,NaN,...
48.1, 50.0, 50.5, 50.7, 50.1, 48.9, 47.6,...
NaN,49.7, 50.2, 50.3, 49.8, 48.6,NaN,...
NaN,48.2, 49.5, 49.7, 49.0, 48.0,NaN,...
NaN,NaN,NaN,48.5,NaN,NaN,NaN,]/Center;
X = reshape(X,7,7);
Y = reshape(Y,7,7);
Z = reshape(Z,7,7);
figure;
r = 3.5/100; % Radius of the sample [cm]
ang=0:0.01:2*pi;
xp=r*cos(ang);
yp=r*sin(ang);
zp = abs(5+xp);
h1 = surf(X,Y,Z, 'FaceColor','interp', 'EdgeColor', 'none');
xlabel('Radius [m]')
ylabel('Radius [m]')
colormap hot
view(2), colorbar, axis square tight
hold on
h2 = plot3(xp,yp,zp, 'w');
grid on
set(gca,'layer','top', 'tickdir', 'out', 'linewidth', 1.5);
tightfig_add_right;
print -dpdf -r600 In_Plane_0mm_HF_Map_080315.pdf
Thanks,
Josh

Answers (1)

Use the opengl renderer. The last line to print the pdf should be:
print -dpdf -r600 -opengl In_Plane_0mm_HF_Map_080315.pdf

4 Comments

If I do this it no longer prints the white circle I need on the plot as well.
Really? That's surprising.
What version of MATLAB, and what does 'opengl info' say?
This sounds like the R2014b and later issue whose major discussion is at http://uk.mathworks.com/matlabcentral/answers/162257-problem-with-patch-graphics-in-2014b-splits-in-two-along-diagonal and which has not been resolved yet.
(I am seeing multiple posts from upset people saying that they are going to stop using MATLAB because of this; this and the problem with fonts not being included or being substituted as of R2014b eps files are generating a fair bit of bad feeling.)
No, I meant the part about not drawing the white circle with the opengl renderer. That sounds like a clip plane accuracy issue that I thought we had eradicated. If it's still around, I'd like to know how to repro it.

Sign in to comment.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Tags

Asked:

on 1 Dec 2015

Commented:

on 4 Dec 2015

Community Treasure Hunt

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

Start Hunting!