from pylab import * import scipy.stats def sine_plot(): t = arange(0.0, 100, 1) s = sin(0.1*pi*t)*exp(-t*0.01) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(t,s, label = "Original") ax.plot(t,s*2, label = "Doubled") ax.legend() return ax ax = sine_plot() import mpltools.style mpltools.style.use('ggplot') ax = sine_plot() import gg ax = sine_plot() gg.rstyle(ax) data = scipy.stats.norm.rvs(size = 1000) fig = plt.figure() ax = fig.add_subplot(111) _ = gg.rhist(ax, data, label='Histogram', bins=50) ax.legend() gg.rstyle(ax) x_range = np.linspace(-8, 8, 100) fig = plt.figure() ax = fig.add_subplot(111) _ = gg.rfill(ax, x_range, scipy.stats.norm(scale=1).pdf(x_range)) _ = gg.rfill(ax, x_range, scipy.stats.norm(scale=2).pdf(x_range)) gg.rstyle(ax) x_range = np.linspace(-4, 4, 100) fig = plt.figure() ax1 = fig.add_subplot(111) _ = gg.rhist(ax1, data, bins=30) gg.rstyle(ax1) ax2 = ax1.twinx() _ = gg.rfill(ax2, x_range, scipy.stats.norm(scale=1).pdf(x_range)) box_data = [ scipy.stats.norm.rvs(size = 100), scipy.stats.norm.rvs(size = 100), scipy.stats.norm.rvs(size = 100)] fig = plt.figure() ax = fig.add_subplot(111) ax.legend() gg.rbox(ax, box_data, names=("One", "Two", "Three"), colors=["#1f77b4", "#ff7f0e"]) gg.rstyle(ax)