In [7]:
from matplotlib  import pyplot as PLT
%matplotlib inline
import numpy as np

In [5]:
fig = PLT.figure(figsize=(12,9))

# sub1 = fig.add_subplot(221) # equivalent to: plt.subplot(2, 2, 1)  (nrow, ncol, plot_no)
ax1 = fig.add_subplot(2,2,1)
ax1.plot([(1, 2), (3, 4)], [(4, 3), (2, 3)])

ax2 = fig.add_subplot(2,2,4)
ax2.plot([(7, 2), (5, 3)], [(1, 6), (9, 5)])

PLT.show()



In [12]:
PLT.figure(figsize=(12,9))
for i in range(19):
    PLT.subplot(5,4,i+1)



In [13]:
fig, axes = PLT.subplots(nrows=2, ncols=3, sharex=True, sharey=True)
#print(fig, axes)
axes[1,1].plot([1,2,3,4], [2,3,4,5], color='red')
axes[1,2].plot([1,2,3,4], np.sin([1,2,3,4]), color='red')


Out[13]:
[<matplotlib.lines.Line2D at 0x873edd8>]

In [ ]: