|
| 1 | +import numpy as np |
| 2 | +import matplotlib.pyplot as plt |
| 3 | +import matplotlib.cm as cm |
| 4 | +import matplotlib.mlab as mlab |
| 5 | + |
| 6 | +axalpha = 0.05 |
| 7 | +fig = plt.figure(figsize=(8, 2),dpi=80) |
| 8 | +fig.figurePatch.set_edgecolor('#FFFFCC') |
| 9 | +fig.figurePatch.set_facecolor('#FFFFCC') |
| 10 | + |
| 11 | +# the polar bar plot |
| 12 | +ax = fig.add_axes([0.05, 0.05, 0.2, 01], polar=True) |
| 13 | +ax.axesPatch.set_alpha(axalpha) |
| 14 | +N = 20 |
| 15 | +theta = np.arange(0.0, 2*np.pi, 2*np.pi/N) |
| 16 | +radii = 10*np.random.rand(N) |
| 17 | +width = np.pi/4*np.random.rand(N) |
| 18 | +bars = ax.bar(theta, radii, width=width, bottom=0.0) |
| 19 | +for r,bar in zip(radii, bars): |
| 20 | + bar.set_facecolor( cm.jet(r/10.)) |
| 21 | + bar.set_alpha(0.5) |
| 22 | + |
| 23 | +for label in ax.get_xticklabels() + ax.get_yticklabels(): |
| 24 | + label.set_visible(False) |
| 25 | + |
| 26 | + |
| 27 | +# the histogram |
| 28 | +axhist = fig.add_axes([0.275, 0.075, 0.2, 0.4]) |
| 29 | +axhist.axesPatch.set_alpha(axalpha) |
| 30 | +mu, sigma = 100, 15 |
| 31 | +x = mu + sigma*np.random.randn(10000) |
| 32 | + |
| 33 | +# the histogram of the data |
| 34 | +n, bins, patches = axhist.hist(x, 50, normed=1, facecolor='green', edgecolor='green', alpha=0.75) |
| 35 | + |
| 36 | + |
| 37 | +y = mlab.normpdf( bins, mu, sigma) |
| 38 | +l = axhist.plot(bins, y, 'r', lw=1) |
| 39 | + |
| 40 | +axhist.set_title('Density of IQ',fontsize=6) |
| 41 | +axhist.set_xlabel('IQ', fontsize=6) |
| 42 | +axhist.set_ylabel('P(IQ)', fontsize=6) |
| 43 | +ax.set_xlim(-2*sigma, 2*sigma) |
| 44 | +for label in axhist.get_xticklabels() + axhist.get_yticklabels(): |
| 45 | + label.set_visible(False) |
| 46 | + |
| 47 | + |
| 48 | +axback = fig.add_axes([0., 0., 1., 1.]) |
| 49 | + |
| 50 | +#the math background |
| 51 | +tex = r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]$" |
| 52 | +axback.text(0.5, 0.5, tex, |
| 53 | + transform=axback.transAxes, color="0.5", alpha=0.5, fontsize=40, |
| 54 | + ha='center', va='center') |
| 55 | +axback.set_axis_off() |
| 56 | + |
| 57 | +# the matplotlib title |
| 58 | +axback.text(0.3, 0.95, 'matplotlib', color='black', fontsize=75, |
| 59 | + ha='left', va='top', alpha=1.0, |
| 60 | + transform=axback.transAxes) |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +plt.show() |
| 65 | + |
0 commit comments