Borrar filtros
Borrar filtros

Print .eps or .pdf contourf plot with 'edgecolor','none' leaves white lines between levels - need to get rid of them (2019b)

11 visualizaciones (últimos 30 días)
Hi, I am having the following problem:
When I create a contourf plot and remove the lines between levels, as I try to print as .eps or .pdf, I end up with many unwanted white lines separating the levels. This does not happen when I print a .png or the number of levels is small.
I have reproduced the problem with the example for contourf given in Matlab website (https://www.mathworks.com/help/matlab/ref/contour.html), see code below.
The choice of colormap does not affect the result. However, I need to use colormap('grey'), and in that case the problem is even more obvious.
Thank you
clc, close all, clear all
Z = peaks;
colormap(gray);
contourf(Z,linspace(min(min(Z)),max(max(Z)),30),'edgecolor','none')
print('test','-dpdf');
print('test','-depsc2');
print('test','-dpng');
disp('DONE')

Respuesta aceptada

Kiran Felix Robert
Kiran Felix Robert el 8 de Oct. de 2020
Hi Pablo,
The rendered white lines in a PDF file can be removed by force setting the renderer of the figure to opengl and using the saveas function instead of the print function.
The following is an example,
clc, close all, clear all
Z = peaks;
colormap(gray);
contourf(Z,linspace(min(min(Z)),max(max(Z)),30),'LineColor','none')
% To save the figure
set(gcf,'renderer','opengl');
saveas(gcf, 'test', 'pdf')
saveas(gcf,'test','epsc')
saveas(gcf,'test.png')
%%%%%
disp('DONE')
Kiran Felix Robert

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by