如何在ipython/jupyter笔记本单元格中设置图片显示位置?
How to set picture display location in ipython/jupyter notebook cell?
我尝试在 ipython 单元格中绘制多张图片以进行比较。这是我从以下节点
得到的
import numpy as np
from matplotlib import pylab
x = np.linspace(1.0,13.0,10)
y = np.sin(x)
pylab.plot(x,y)
show()
x = np.linspace(1.0,13.0,20)
y = np.sin(x)
pylab.plot(x,y)
show()
x = np.linspace(1.0,13.0,30)
y = np.sin(x)
pylab.plot(x,y)
show()
如何将这些图片绘制成如下方向?
简短的回答是,目前你不能......除非你制作一个由 3 个子图组成的数字。
可能像这样:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
f, (ax1, ax2, ax3) = plt.subplots(1,3, figsize=(20,5))
x = np.linspace(1.0,13.0,10)
y = np.sin(x)
ax1.plot(x,y)
x = np.linspace(1.0,13.0,20)
y = np.sin(x)
ax2.plot(x,y)
x = np.linspace(1.0,13.0,30)
y = np.sin(x)
ax3.plot(x,y)
plt.show()
我尝试在 ipython 单元格中绘制多张图片以进行比较。这是我从以下节点
import numpy as np
from matplotlib import pylab
x = np.linspace(1.0,13.0,10)
y = np.sin(x)
pylab.plot(x,y)
show()
x = np.linspace(1.0,13.0,20)
y = np.sin(x)
pylab.plot(x,y)
show()
x = np.linspace(1.0,13.0,30)
y = np.sin(x)
pylab.plot(x,y)
show()
如何将这些图片绘制成如下方向?
简短的回答是,目前你不能......除非你制作一个由 3 个子图组成的数字。
可能像这样:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
f, (ax1, ax2, ax3) = plt.subplots(1,3, figsize=(20,5))
x = np.linspace(1.0,13.0,10)
y = np.sin(x)
ax1.plot(x,y)
x = np.linspace(1.0,13.0,20)
y = np.sin(x)
ax2.plot(x,y)
x = np.linspace(1.0,13.0,30)
y = np.sin(x)
ax3.plot(x,y)
plt.show()