Compare differences between MATLAB and python images from the same data -
i ploting same values in python , in matlab ( the data same).
just doing
import scipy.io sio zzz = sio.loadmat(pathtodata) plot(zzz['zzz'][:,0]) #python
in matlab
plot(zzz) %matlab
i trying matplotlib
create image looks same matlab figure, this example.
- the following images created screen capture avoid post processing of image. made sure both of figures in same size. put 1 next other , created screencapture of them both @ same time
i put lines 1 next other:
it bit hard see matlab image more noisy , looks python image after moving average of ( in start of plot)
do have any advice of how make python figure exactly matlab one?
( uploaded the data
if interested in experiments )
edit
i tried antialiased = false, results bit better, linewidth bigger no matter how small try (original screencapture )
i think due fact matplotlib uses anti aliasing when producing figure. however, artist property can set:
import matplotlib.pyplot plt import numpy np x = np.linspace(0, 2*np.pi, 500) plt.plot(x, np.sin(x), label='with anti-aliasing') plt.plot(x, np.cos(x), antialiased=false, label='without anti-aliasing') plt.legend() plt.show()
result:
zoom on top left corner:
so switching off anti-aliasing filter might similar results matlab version.
Comments
Post a Comment