How to eliminate anti-aliasing in matplotlib (pyplot)?

I am doing some colormap plot using Julia PyPlot implementation. I want the figure to be without any interpolation or smooting, and I want it to be saved as svg, after which it can be manipulated by other people. In a Jupyter laptop appears how I want it to appear, and if I save it as png, it will be saved as I want. But if I save it as svg, the color palette is smoothed, which is clearly wrong for my data. Code:

figure(figsize=(7.0, 5.5))
PyPlot.xlim(1,64)
PyPlot.ylim(1,64)
otraimagen=imshow(EjemploModificado, cmap="bwr", interpolation="none", origin="lower", vmin=-limites, vmax=limites, extent=[1,64,1,64])
use_gridspace='True')
use_gridspec="True",fraction=0.045 )
tick_params(axis="both", labelsize=14)   
xlabel("electrode number", fontsize=14)
ylabel("electrode number", fontsize=14)
savefig("CSD-Neg-Pos-$t.png", dpi=90) 
PyPlot.close_queued_figs()

Produced images like png: enter image description here

and like svg (later converted to png so that I can deploy it): enter image description here

+4
source share
1 answer

, SVG, @FelipeLema, , .

interpolation='none' interpolation='nearest'. , , (, PDF, SVG).

matplotlib : http://matplotlib.org/examples/images_contours_and_fields/interpolation_none_vs_nearest.html " " .

interpolation='none' , . , matplotlib, . PDF , - .

, interpolation='nearest' , .

, SVG- , PDF-, , @FelipeLema , SVG interpolation='none'.

+2

Source: https://habr.com/ru/post/1627842/


All Articles