简体   繁体   中英

How to set picture display location in ipython/jupyter notebook cell?

I try to plot multiple pictures in the ipython cell for comparison. Here is what I have got from the below nodes 在此处输入图片说明

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()

How can I plot these pictures as the following direction?

The short answer is that at this moment you can't... unless you make one figure of 3 subplots.

Like this maybe:

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()

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM