-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug in fig_to_html, TypeError: array([ 1.]) is not JSON serializable #441
Comments
|
I am also getting the same error. I'm using Python 2.7.4, mpld3 v0.2, and matplotlib v2.1.2. I believe the issue is with matplotlib. Are there plans to update mpld3 to be compatible with the latest version of matplotlib? |
I found a fix to this one: you can edit the _display.py file found in Lib\site-packages\mpld3 and replace the NumpyEncoder class by this one:
|
For matplotlib version 2.2.3, I found it to be enough to convert linewidths from numpy arrays to lists in mpld3.mpld3renderer.MPLD3Renderer.draw_path_collection. |
Still an issue with latest version |
@jonashaag @ceprio 's commented on Apr 26, 2018 above, just now fixed it with me. |
Hi @jonashaag and @JupyterJones , could you confirm if this is also issue on https://github.com/sciris/mpld3? |
@ceprio 's comment worked for me too |
It happens when adding colorbar to 2D images generated with imshow, only on Mac.
mpld3.version='0.3.1.dev1' (failing also in previous versions)
matplotlib.version='2.1.0'
import matplotlib.pyplot as plt, mpld3 import numpy as np fig,ax=plt.subplots(1,1) im=ax.imshow(np.zeros((100,100))) fig.colorbar(im, ax=ax) mpld3.fig_to_html(fig)
The text was updated successfully, but these errors were encountered: