In my python program I plot some 2D graphs with imshow:
img=imshow(data,
interpolation='none',
vmin=0.0001,
vmax=0.01,
cmap=custom_map,
norm=LogNorm()
)
When I save the plot as *.eps or *.pdf I get some strange lines in the pictures, where the values of data
are very close to vmin
.
When I save the plot as *.png or *.svg or *.jpg this error doesn't occur.
How can I avoid that python draws this strange lines?
EDIT: Here is a minimal code which should reproduce the problem. At least I get the error all the times...
from matplotlib.colors import LogNorm
import numpy as np
import matplotlib.pyplot as pl
A=np.array([[0.000000,0.000426],[0.000000,0.000524]], dtype=np.float)
pl.imshow(A, interpolation='none', norm=LogNorm())
pl.savefig('test.eps')
pl.savefig('test.png')
Even if you do not use LogNorm()
but use np.log(A)
the problem occurs in the output.
Edit 2 With
A=np.array([[np.log(0),np.log(0),np.log(0.1),np.log(0.000426)],
[np.log(0),np.log(0),np.log(0),np.log(0.000524)]], dtype=np.float)
the problem occurs only at the borders from np.log(0) to some real values as you can see in the next picture