Nick-H
Nick-H

Reputation: 398

Why are Mayavi inline plots showing up as text in Jupyter Notebook?

I followed the instructions located here for setting up inline plots with mayavi in jupyter notebook but it is not working. When I run the following code,

from mayavi import mlab

mlab.init_notebook()
mlab.test_plot3d()

instead of displaying the plot inline in the notebook it prints the following below the cell:

Image(value=b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01\x90
\x00\x00\x01^\x08\x02\x00\x00\x00$?\xde_\x00\…

Why might this be happening? I have made sure that mayavi is updated to version 4.7.1 and that I am using the ipy backend.

Upvotes: 1

Views: 2049

Answers (1)

dowa
dowa

Reputation: 31

You can change the backend from ipy to 'x3d' for interactive plots or to 'png' for static plots:

mlab.init_notebook(backend='x3d')

If you're working with JupyterLab you should launch the classic notebook and try it again.

Changeing to classic and using x3d instead of ipy solved it for me.

Upvotes: 3

Related Questions