我在装有 M1 芯片的 MacBook Pro 上使用 macOS 版本 11.4,软件版本低于:
笔记本中不会呈现空白图形,但笔记本中确实会显示具有至少 1 个子图或轴的图形。有人可以帮我理解为什么会这样吗?我以前在 Windows 笔记本电脑中尝试过同样的事情,甚至会出现空白数字。代码如下:
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
# the below line does not show any image
fig = plt.figure(facecolor=(1,0,0,0.1), figsize=plt.figaspect(0.5))
plt.show();
# the output is - "<Figure size 576x288 with 0 Axes>"
#whereas, if I add a subplot to the figure, it renders a figure inline in the notebook
fig = plt.figure(facecolor=(1,0,0,0.1), figsize=plt.figaspect(0.5))
ax = fig.add_subplot(111)
plt.show();