小编aqu*_*tle的帖子

Jupyter:在不同单元格中的重复

我想做这样的事情:

import matplotlib.pyplot as plt
%matplotlib inline
fig1 = plt.figure(1)
plt.plot([1,2,3],[5,2,4])
plt.show()
Run Code Online (Sandbox Code Playgroud)

在一个单元格中,然后在另一个单元格中重绘完全相同的图,如下所示:

plt.figure(1) # attempting to reference the figure I created earlier...
# four things I've tried:
plt.show() # does nothing... :(
fig1.show() # throws warning about backend and does nothing
fig1.draw() # throws error about renderer
fig1.plot([1,2,3],[5,2,4]) # This also doesn't work (jupyter outputs some 
# text saying matplotlib.figure.Figure at 0x..., changing the backend and 
# using plot don't help with that either), but regardless in reality
# …
Run Code Online (Sandbox Code Playgroud)

python matplotlib jupyter

7
推荐指数
1
解决办法
584
查看次数

标签 统计

jupyter ×1

matplotlib ×1

python ×1