Skip to content
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

Contourf + colorbar failure #226

Open
wfbradley opened this issue Aug 4, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@wfbradley
Copy link

commented Aug 4, 2014

When I try to put a colorbar() next to a contourf() plot in iPython notebook, the colorbar fails to show and I get the error:

Javascript error adding output!
TypeError: t is null
See your browser Javascript console for more details.

(The Javascript console error is at the end of this message.) A minimal code snippet that reproduces the problem is here:

import matplotlib.pyplot as plt
import numpy as np

%matplotlib inline
import mpld3
mpld3.enable_notebook()
#mpld3.disable_notebook()

plt.figure()

x_vals=np.linspace(0,10)
y_vals=np.linspace(0,10)
z_vals=np.random.random((len(x_vals),len(y_vals)))

tmp=plt.contourf(x_vals,y_vals,z_vals)
tmp=plt.colorbar()

Note if I disable mpld3, the problem goes away. I'm using Firefox 31.0.

Javascript verbiage from console:

Empty string passed to getElementById(). jquery.min.js:4
TypeError: t is null
Stack trace:
e@https://mpld3.github.io/js/d3.v3.min.js:2:24766
da.text/<@https://mpld3.github.io/js/d3.v3.min.js:3:9357
da.each/<@https://mpld3.github.io/js/d3.v3.min.js:3:11756
R@https://mpld3.github.io/js/d3.v3.min.js:1:3717
da.each@https://mpld3.github.io/js/d3.v3.min.js:3:11726
da.text@https://mpld3.github.io/js/d3.v3.min.js:3:9333
n/<@https://mpld3.github.io/js/d3.v3.min.js:5:9077
da.each/<@https://mpld3.github.io/js/d3.v3.min.js:3:11756
R@https://mpld3.github.io/js/d3.v3.min.js:1:3717
da.each@https://mpld3.github.io/js/d3.v3.min.js:3:11726
n@https://mpld3.github.io/js/d3.v3.min.js:5:8498
da.call@https://mpld3.github.io/js/d3.v3.min.js:3:11831
mpld3_Axis.prototype.draw@https://mpld3.github.io/js/mpld3.v0.3git.js:336:5
mpld3_Axes.prototype.draw@https://mpld3.github.io/js/mpld3.v0.3git.js:785:7
mpld3_Figure.prototype.draw@https://mpld3.github.io/js/mpld3.v0.3git.js:1407:7
mpld3.draw_figure@https://mpld3.github.io/js/mpld3.v0.3git.js:18:5
@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd line 4 > eval:14:1087820
@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd line 4 > eval:15:1
.globalEval@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:4:4182
.domManip@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:5:21320
.append@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:5:18973
IPython</OutputArea.prototype._safe_append@http://localhost:8888/static/notebook/js/outputarea.js?v=b7a027e8d15c522578a4142b8342789f:394:13
IPython</OutputArea.prototype.append_display_data@http://localhost:8888/static/notebook/js/outputarea.js?v=b7a027e8d15c522578a4142b8342789f:489:13
IPython</OutputArea.prototype.append_output@http://localhost:8888/static/notebook/js/outputarea.js?v=b7a027e8d15c522578a4142b8342789f:306:13
IPython</OutputArea.prototype.handle_output@http://localhost:8888/static/notebook/js/outputarea.js?v=b7a027e8d15c522578a4142b8342789f:234:9
.proxy/i@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:4:5479
IPython</Kernel.prototype._handle_output_message@http://localhost:8888/static/services/kernels/js/kernel.js?v=4f7e3edf038579ed584b87f5c10a24ad:583:13
.proxy/i@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:4:5479
IPython</Kernel.prototype._handle_iopub_message@http://localhost:8888/static/services/kernels/js/kernel.js?v=4f7e3edf038579ed584b87f5c10a24ad:594:13
.proxy/i@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:4:5479
 outputarea.js:396
Empty string passed to getElementById(). jquery.min.js:4
TypeError: t is null
Stack trace:
e@https://mpld3.github.io/js/d3.v3.min.js:2:24766
da.text/<@https://mpld3.github.io/js/d3.v3.min.js:3:9357
da.each/<@https://mpld3.github.io/js/d3.v3.min.js:3:11756
R@https://mpld3.github.io/js/d3.v3.min.js:1:3717
da.each@https://mpld3.github.io/js/d3.v3.min.js:3:11726
da.text@https://mpld3.github.io/js/d3.v3.min.js:3:9333
n/<@https://mpld3.github.io/js/d3.v3.min.js:5:9077
da.each/<@https://mpld3.github.io/js/d3.v3.min.js:3:11756
R@https://mpld3.github.io/js/d3.v3.min.js:1:3717
da.each@https://mpld3.github.io/js/d3.v3.min.js:3:11726
n@https://mpld3.github.io/js/d3.v3.min.js:5:8498
da.call@https://mpld3.github.io/js/d3.v3.min.js:3:11831
mpld3_Axis.prototype.draw@https://mpld3.github.io/js/mpld3.v0.3git.js:336:5
mpld3_Axes.prototype.draw@https://mpld3.github.io/js/mpld3.v0.3git.js:785:7
mpld3_Figure.prototype.draw@https://mpld3.github.io/js/mpld3.v0.3git.js:1407:7
mpld3.draw_figure@https://mpld3.github.io/js/mpld3.v0.3git.js:18:5
@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd line 4 > eval:14:1141877
@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd line 4 > eval:15:1
.globalEval@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:4:4182
.domManip@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:5:21320
.append@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:5:18973
IPython</OutputArea.prototype._safe_append@http://localhost:8888/static/notebook/js/outputarea.js?v=b7a027e8d15c522578a4142b8342789f:394:13
IPython</OutputArea.prototype.append_display_data@http://localhost:8888/static/notebook/js/outputarea.js?v=b7a027e8d15c522578a4142b8342789f:489:13
IPython</OutputArea.prototype.append_output@http://localhost:8888/static/notebook/js/outputarea.js?v=b7a027e8d15c522578a4142b8342789f:306:13
IPython</OutputArea.prototype.handle_output@http://localhost:8888/static/notebook/js/outputarea.js?v=b7a027e8d15c522578a4142b8342789f:234:9
.proxy/i@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:4:5479
IPython</Kernel.prototype._handle_output_message@http://localhost:8888/static/services/kernels/js/kernel.js?v=4f7e3edf038579ed584b87f5c10a24ad:583:13
.proxy/i@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:4:5479
IPython</Kernel.prototype._handle_iopub_message@http://localhost:8888/static/services/kernels/js/kernel.js?v=4f7e3edf038579ed584b87f5c10a24ad:594:13
.proxy/i@http://localhost:8888/static/components/jquery/jquery.min.js?v=ccd0edd113b78697e04fb5c1b519a5cd:4:5479
 outputarea.js:396
Empty string passed to getElementById(). jquery.min.js:4
@aflaxman

This comment has been minimized.

Copy link
Collaborator

commented Aug 4, 2014

Thanks for this report. I tried it in Chrome and FF 29.0.1, and it works for me there:

image

I hope someone has time to investigate why it's not working in FF 31.0, but I will not get to it for a little while myself, due to other pressing deadlines.

@aflaxman

This comment has been minimized.

Copy link
Collaborator

commented Aug 4, 2014

Hmm, it seems to work for me in FF 31 also:

image

@wfbradley

This comment has been minimized.

Copy link
Author

commented Aug 4, 2014

Hmm, very interesting. I just tried it in Chrome (Version 36.0.1985.125) and it didn't work (that is, it failed in the same way; with mpld3 turned off, it worked correctly). How mysterious. (Restarting my iPython notebook server didn't help.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.