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