Contourf lines showing up on PDF
37 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Austin
el 7 de Dic. de 2023
Comentada: Adam Danz
el 12 de Dic. de 2023
I created some contourf plots, set the LevelStep to 1, and removed the lines using LineStyle='none'. I can copy and paste the figure into PowerPoint and they look great, exactly like I want. But then, when I save the PowerPoint file as a PDF, white lines will appear that look like the contour lines. Is there any way to get it so that they will not show up in the PDF. Attached is the code as well as screenshots from the PPT and the PDF (The black dots are just a scatterplot that I overlaid on the contour plots). Thanks in advance!
[M, c] = contourf(X,Y,Z,'LineStyle','none');
colormap turbo
clim(limits);
c.LevelStep = 1;
xticklabels("");
yticklabels("");
PPT:
PDF:
6 comentarios
Star Strider
el 7 de Dic. de 2023
If you want the colours only and not the lines, another option might be to use surf instead, with 'FaceColor','interp', 'EdgeColor','interp' and ‘view(0,90)’.
Dyuman Joshi
el 8 de Dic. de 2023
@Austin, Is saving the plot directly as pdf an option?
As that generates a high quality image.
Respuesta aceptada
Adam Danz
el 8 de Dic. de 2023
I tested this in R2023a (and 23b) with the following workflow and could not reproduce the result reported in the question.
[X Y Z] = peaks();
[M, c] = contourf(X,Y,Z,'LineStyle','none');
colormap turbo
% clim(limits);
c.LevelStep = 1;
xticklabels("");
yticklabels("");
copygraphics(gcf,'ContentType','image','BackgroundColor','none')
% Paste in ppt
% Save as pdf
% open pdf file
I noticed the reproduction steps in the quesiton aren't complete since they do not produce the black dots. Be sure you're not plotting anything else to those axes such as a second controup map.
I'm curious how you are copying the figure to the powerpoint. If you haven't tried it already, try using copygraphics as shown in my answer or export the figure directly to a pdf format using
exportgraphics(gcf, 'myFig.pdf','ContentType','vector')
2 comentarios
Adam Danz
el 12 de Dic. de 2023
The issue is likely caused by the conversion from ppt to pdf. The copied figure is a vector image unless you've changed the default copy behavior. When the ppt file is saved as a PDF, my guess is that the image is flattened which results in the lines mysteriously appearing. I doubt it has anything to do with MATLAB, although I could be wrong. Another possibility is the color borders creating an edge during the flattening process. I briefly looked for potential causes of lines appearing at color borders when saving a ppt ot pdf. There were lots of issues reported with this conversion but I didn't find any close matches to this specific problem.
When copying the figure from MATLAB to ppt, if you copy the figure as png rather than in vector format, my bet is the problem goes away because then it's already in vector format in the PPT.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!