graphics - How to eliminate smoothing in matplotlib (pyplot)? -
i doing colormap plot using julia implementation of pyplot. want figure without interpolation or smooting, , want saved svg can manipulated afterwards other people. in jupyter notebook appears want appear, , if save png gets saved want. if save svg, colormap gets smoothed, plainly wrong data. code is:
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()
for it's worth, in addition svg-specific issue @felipelema mentioned, there's point should aware of.
there difference between interpolation='none' , interpolation='nearest'. applies vector formats, you'll using viewer produce rasterized version that's displayed on-screen (e.g. pdf, svg).
there's nice visual summary in matplotlib example here: http://matplotlib.org/examples/images_contours_and_fields/interpolation_none_vs_nearest.html in case, we'd talking "small image blown up" portion of example.
interpolation='none' tells viewer there's no specific interpolation type required. raster images produced matplotlib, nearest interpolation. pdf viewers nearest, , others it's bilinear or smooth interpolator.
however, interpolation='nearest' specifies want nearest-neighbor interpolation.
i don't recall offhand whether svg viewers behave in similar way pdf viewers in specific regard, bug @felipelema mentioned fixed, may not see nearest-neighbor interpolation in svg viewers interpolation='none'.


Comments
Post a Comment