3

I am using mpld3 to draw some plots in a browser. The scatter-plot is showing the correct colors, but the colorbar for the plot has the wrong labels. The colorbar is always labeled from 0 to 1, although vmin and vmax are different. Any ideas?

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"))
medit
  • 51
  • 2
  • I do not have this effect in version 1.4, the colorbar is from -200 to 200 as it should be. Perhaps update your matplotlib version and see what happens then? – Ajean Sep 24 '14 at 19:31
  • I have updated my matplotlib and still got the same problem. [example](https://imageshack.com/i/kmnEDFxZp) – medit Sep 26 '14 at 10:22

1 Answers1

1

This looks like an mpld3 bug. Thanks for identifying it. I've opened an issue for it here. Patches welcome!

Abraham D Flaxman
  • 2,969
  • 21
  • 39