using matplotlib I can make an interactive 3D plot in jupyter notebook . I use the following example code . It s easy and not the problem. But after converting the notebook in html, the interactive 3D plot became non-interactive. I mean, it can not be rotated like before. It is just a static image. I used menue File->Download as -> HTML to convert the notebook to html file. But I just want to keep the interactivity even after converting. Does anyone have a good idea?
I have already known that there is a way for 2D interactive plot. But I can not find any idea to do this for a 3D interactive plot.
Thanks for any idea.
'''
==============
3D scatterplot
==============
Demonstration of a basic scatterplot in 3D.
'''
%matplotlib notebook
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import animation
def randrange(n, vmin, vmax):
'''
Helper function to make an array of random numbers having shape (n, )
with each number distributed Uniform(vmin, vmax).
'''
return (vmax - vmin)*np.random.rand(n) + vmin
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
n = 100
# For each set of style and range settings, plot n random points in the box
# defined by x in [23, 32], y in [0, 100], z in [zlow, zhigh].
for c, m, zlow, zhigh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]:
xs = randrange(n, 23, 32)
ys = randrange(n, 0, 100)
zs = randrange(n, zlow, zhigh)
ax.scatter(xs, ys, zs, c=c, marker=m)
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.show()