【发布时间】:2021-07-02 04:54:17
【问题描述】:
我有一些在 Spyder 中运行的代码,但是当我尝试在 Jupiter 笔记本中运行它时它不起作用(我尝试将 %matplot lib 放在单元格的顶部,但我只是收到以下错误: AttributeError: 'NoneType' 对象没有属性 'lower') 这是代码:
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import animation
def randrange(n, vmin, vmax):
return (vmax - vmin) * np.random.rand(n) + vmin
n = 100
xx = randrange(n, 23, 32)
yy = randrange(n, 0, 100)
zz = randrange(n, -50, -25)
fig = plt.figure()
ax = Axes3D(fig)
def init():
ax.scatter(xx, yy, zz, marker='o', s=20, c="goldenrod", alpha=0.6)
return fig,
def animate(i):
ax.view_init(elev=10., azim=i)
return fig,
# Animate
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=360, interval=20, blit=True)
有什么想法吗?
【问题讨论】:
标签: python matplotlib jupyter-notebook spyder