How to avoid artefacts in filled contour plots

3 views (last 30 days)
J
J on 5 Feb 2015
Commented: Petar Lambrev on 28 Mar 2017
I am trying to export filled contour plots from Matlab as vector graphics to include in a Latex file. My current methodology is:
contourf(x,y,v_mag,20), axis([0,width,0,height]),daspect('manual') ;
grid off
colormap jet
h = colorbar;
caxis([0 v_lid])
h.Label.String = 'Velocity Magnitude (m/s)';
set(gcf,'renderer','painters')
export_fig('-painters', '-transparent', 'pdf', 'filename.pdf');
The problem with this method is that it produces artefacts (the white lines) which look like the following:
I understand that these white lines are the polygons defining the shaded areas which have invisible edges, and don't quite overlap ( according to here ). The problem is caused by the pdf viewer itself which tries to smooth the lines displayed on the screen ( according to here ). My problem is that most people viewing the document will not know this and will not know how to prevent the viewer doing this. So my questions is:
Is it possible to create a vector graphic of a filled contour plot from Matlab without these artefacts?
Eps produces the same problems. I have tried to use the SVG function but have not had any luck. I am trying to avoid using raster graphics due to the pixelation caused by zooming in. Any advice would be much appreciated.
EDIT - Additional info - Using Matlab v.2014b and Ghostscript v.9.15
I posted the exact same question over on StackOverflow but no joy: http://stackoverflow.com/questions/28325901/matlab-how-to-avoid-artefacts-in-filled-contour-plots
  2 Comments
Petar Lambrev
Petar Lambrev on 28 Mar 2017
The only working solution we have is MATLAB 2014a. Of course the scripts need some adjustment to be compatible with it and you will lose the niceties of the newer versions.

Sign in to comment.

Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!