Pythoner
Pythoner

Reputation: 5585

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 enter image description here

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?

Upvotes: 0

Views: 638

Answers (1)

Reblochon Masque
Reblochon Masque

Reputation: 36682

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

enter image description here

Upvotes: 1

Related Questions