python - matplotlib svg save - light borders around contourf levels -


the following code taken in part contour demo of matplotlib documentation. using contourf instead of simple contour. contour plot shown want within matplotlib figure window.

as comes saving not content result. png save looks perfect, not have levels, png si no vector format. when saving pdf of svg format have levels, there thin light borders around levels. @ first thought caused, because every level getting stroke around. when opening svg file inkscape drop strokes, found out, levels saved bit small or bit large respectively... hardly note them, when zoom in, zooming out quite prominent. suppose due fact, values of levels saved low precision!? possible rid of theese borders command?

i aware these borders not make difference in applicative contexts. unfortunately using them not ugly, disturb quality of depicted results...

import matplotlib import numpy np import matplotlib.cm cm import matplotlib.mlab mlab import matplotlib.pyplot plt  matplotlib.rcparams['xtick.direction'] = 'out' matplotlib.rcparams['ytick.direction'] = 'out'  delta = 0.025 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0, delta) x, y = np.meshgrid(x, y) z1 = mlab.bivariate_normal(x, y, 1.0, 1.0, 0.0, 0.0) z2 = mlab.bivariate_normal(x, y, 1.5, 0.5, 1, 1) z = 10.0 * (z2 - z1)  plt.ion() plt.figure() cs = plt.contourf(x, y, z, colors=[[0,0,0.5],[0,0,0.2]]) plt.title('saved png') plt.savefig('image1.png')  plt.title('saved svg') plt.savefig('image1.svg') 

saved png saved svg


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -