Wednesday, 15 June 2011

python - why does my colorbar have lines in it? -



python - why does my colorbar have lines in it? -

edit: since seems popular post, here's solution seems working me. @gazzar , @mfra.

cbar.solids.set_rasterized(true) cbar.solids.set_edgecolor("face")

does know why colorbar has appear lines in it? or rather why color transition not smooth? i'm using basemap, obviously, shouldn't matter since it's matplotlib calls under hood afaict. create map doing like

grays = plt.cm.get_cmap("grays") sc = mymap.scatter(xpoints, ypoints, s=sizes, c=color_values, cmap=grays, alpha=.75, marker="o", zorder=10, vmin=0, vmax=1) cbar = mymap.colorbar(sc, drawedges=true, location="bottom")

i tried without , without alpha , result same. maybe because color_values array not fine enough? can set underlying values mapped colorbar somewhere? don't see how, , don't see problem elsewhere. ie., can replicate matplotlib show_colorbars illustration without problem.

in case create vector graphics, have tried (taken http://matplotlib.org/api/pyplot_api.html?highlight=colorbar#matplotlib.pyplot.colorbar):

"it known vector graphics viewer (svg , pdf) renders white gaps between segments of colorbar. due bugs in viewers not matplotlib. workaround colorbar can rendered overlapping segments:

cbar = colorbar() cbar.solids.set_edgecolor("face") draw()

however has negative consequences in other circumstances. particularly semi transparent images (alpha < 1) , colorbar extensions , not enabled default see (issue #1188)."

python matplotlib matplotlib-basemap

No comments:

Post a Comment