%matplotlib inline import matplotlib.pyplot as plt import numpy as np # Scatter points fig, ax = plt.subplots() np.random.seed(0) x, y = np.random.normal(size=(2, 200)) color, size = np.random.random((2, 200)) ax.scatter(x, y, c=color, s=500 * size, alpha=0.3) ax.grid(color='lightgray', alpha=0.7) import mpld3 mpld3.display(fig) mpld3.enable_notebook() # Histogram with modified axes/grid fig = plt.figure() ax = fig.add_subplot(111, axisbg='#EEEEEE') ax.grid(color='white', linestyle='solid') x = np.random.normal(size=1000) ax.hist(x, 30, histtype='stepfilled', fc='lightblue', alpha=0.5); # Draw lines fig, ax = plt.subplots() x = np.linspace(-5, 15, 1000) for offset in np.linspace(0, 3, 4): ax.plot(x, 0.9 * np.sin(x - offset), lw=5, alpha=0.4, label="Offset: {0}".format(offset)) ax.set_xlim(0, 10) ax.set_ylim(-1.2, 1.0) ax.text(5, -1.1, "Here are some curves", size=18, ha='center') ax.grid(color='lightgray', alpha=0.7) ax.legend() # multiple subplots, shared axes fig, ax = plt.subplots(2, 2, figsize=(8, 6),sharex='col', sharey='row') fig.subplots_adjust(hspace=0.3) np.random.seed(0) for axi in ax.flat: color = np.random.random(3) axi.plot(np.random.random(30), lw=2, c=color) axi.set_title("RGB = ({0:.2f}, {1:.2f}, {2:.2f})".format(*color), size=14) axi.grid(color='lightgray', alpha=0.7) from mpld3 import plugins fig, ax = plt.subplots(3, 3, figsize=(6, 6)) fig.subplots_adjust(hspace=0.1, wspace=0.1) ax = ax[::-1] X = np.random.normal(size=(3, 100)) for i in range(3): for j in range(3): ax[i, j].xaxis.set_major_formatter(plt.NullFormatter()) ax[i, j].yaxis.set_major_formatter(plt.NullFormatter()) points = ax[i, j].scatter(X[j], X[i]) plugins.connect(fig, plugins.LinkedBrush(points))