3
我正在使用mpld3在瀏覽器中繪製一些圖。散點圖顯示正確的顏色,但情節的顏色條有錯誤的標籤。儘管vmin和vmax不同,但顏色條始終標記爲0到1。有任何想法嗎?錯誤的使用mpld3的colorbar標籤
f, a= plt.subplots(figsize=(10,10))
f.subplots_adjust(left=0.2, right=0.90, bottom=0.05, top=0.95,
hspace=0.1, wspace=0.1)
im=a.scatter(xList,yList,s=40,vmin=-200,vmax=200,edgecolors='none',c=zList)
divider = make_axes_locatable(a)
cax = divider.append_axes("right", size="5%", pad=0.05)
cbar=plt.colorbar(im, cax=cax)
cbar.set_label('Magnetfeld [nt]', labelpad=10)
a.set_xlabel('Distanz [m]')
a.set_ylabel('Distanz [m]', labelpad=100)
a.set_title('korrigiertes Magnetfeld')
a.set_aspect('equal')
return render_template('upload=mobil.html',name=mpld3.fig_to_html(f,template_type="simple"))
我在版本1.4中沒有這種效果,顏色條從-200到200應該是。也許更新你的matplotlib版本,看看會發生什麼? – Ajean 2014-09-24 19:31:59
我已經更新了我的matplotlib,但仍然遇到同樣的問題。 [示例](https://imageshack.com/i/kmnEDFxZp) – medit 2014-09-26 10:22:21