import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
%matplotlib inline
rcParams['figure.figsize'] = 5,4
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot(np.random.randn(50).cumsum(), 'k--')
[<matplotlib.lines.Line2D at 0x7f5146d9bd90>]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.hist(np.random.randn(50), bins=20, color='k', alpha=0.3)
(array([3., 1., 1., 3., 3., 3., 6., 4., 7., 4., 4., 0., 3., 0., 1., 1., 3.,
1., 1., 1.]),
array([-1.45815377, -1.2678492 , -1.07754463, -0.88724006, -0.69693549,
-0.50663092, -0.31632635, -0.12602178, 0.06428279, 0.25458737,
0.44489194, 0.63519651, 0.82550108, 1.01580565, 1.20611022,
1.39641479, 1.58671936, 1.77702393, 1.9673285 , 2.15763308,
2.34793765]),
<BarContainer object of 20 artists>)
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.scatter(np.arange(30), np.arange(30) + 3 * np.random.randn(30))
<matplotlib.collections.PathCollection at 0x7f51472ea460>
rcParams['figure.figsize'] = 12,4
fig = plt.figure()
ax1 = fig.add_subplot(1,2,1)
ax2 = fig.add_subplot(1,2,2)
ax1.hist(np.random.randn(50), bins=20, color='k', alpha=0.3)
ax2.scatter(np.arange(30), np.arange(30) + 3 * np.random.randn(30))
<matplotlib.collections.PathCollection at 0x7f5146c5a940>
fig = plt.figure()
fig, axes = plt.subplots(1,2)
axes[0].hist(np.random.randn(50), bins=20, color='k', alpha=0.3)
axes[1].scatter(np.arange(30), np.arange(30) + 3 * np.random.randn(30))
<matplotlib.collections.PathCollection at 0x7f5146862430>
<Figure size 864x288 with 0 Axes>
fig = plt.figure()
fig, axes = plt.subplots(1,2)
axes[0].hist(np.random.randn(50), bins=20, color='k', alpha=0.3)
axes[1].scatter(np.arange(30), np.arange(30) + 3 * np.random.randn(30))
plt.subplots_adjust(wspace=0, hspace=0)
<Figure size 864x288 with 0 Axes>
import os
os.system('jupyter nbconvert --to html 2b_figure.ipynb')