|
26 | 26 | Y3 = np.random.uniform(Y1, Y2, len(X))
|
27 | 27 |
|
28 | 28 | fig = plt.figure(figsize=(8, 8))
|
29 |
| -marg = 0.15 |
30 |
| -ax = fig.add_axes([marg, marg, 1-1.8*marg, 1-1.8*marg], aspect=1) |
| 29 | +ax = fig.add_axes([0.2, 0.17, 0.68, 0.7], aspect=1) |
31 | 30 |
|
32 | 31 | ax.xaxis.set_major_locator(MultipleLocator(1.000))
|
33 | 32 | ax.xaxis.set_minor_locator(AutoMinorLocator(4))
|
@@ -68,34 +67,34 @@ def annotate(x, y, text, code, radius=0.15):
|
68 | 67 |
|
69 | 68 | ax.text(x, y-0.2, text, zorder=100,
|
70 | 69 | ha='center', va='top', weight='bold', color=royal_blue,
|
71 |
| - style='italic', fontfamily='monospace', |
| 70 | + style='italic', fontfamily='Courier New', |
72 | 71 | path_effects=[withStroke(linewidth=7, foreground=(1, 1, 1, 1))])
|
73 | 72 |
|
74 | 73 | ax.text(x, y-0.33, code, zorder=100,
|
75 | 74 | ha='center', va='top', weight='normal', color='0.0',
|
76 |
| - fontfamily='Courier New', fontsize='medium', |
| 75 | + fontfamily='monospace', fontsize='medium', |
77 | 76 | path_effects=[withStroke(linewidth=7, foreground=(1, 1, 1, 1))])
|
78 | 77 |
|
79 | 78 |
|
80 |
| -annotate(3.25, -0.10, "Minor tick label", "ax.xaxis.set_minor_formatter") |
81 |
| -annotate(-0.03, 1.05, "Major tick", "ax.yaxis.set_major_locator") |
82 |
| -annotate(0.00, 3.75, "Minor tick", "ax.yaxis.set_minor_locator") |
83 |
| -annotate(-0.15, 3.00, "Major tick label", "ax.yaxis.set_major_formatter") |
84 |
| -annotate(1.90, -0.32, "xlabel", "ax.set_xlabel") |
85 |
| -annotate(-0.27, 1.68, "ylabel", "ax.set_ylabel") |
86 |
| -annotate(1.58, 4.13, "Title", "ax.set_title") |
87 |
| -annotate(1.75, 2.80, "Line", "ax.plot") |
88 |
| -annotate(2.25, 1.54, "Markers", "ax.scatter") |
89 |
| -annotate(3.00, 3.00, "Grid", "ax.grid") |
90 |
| -annotate(3.60, 3.65, "Legend", "ax.legend") |
91 |
| -annotate(2.5, 0.55, "Axes", "fig.subplots") |
92 |
| -annotate(4.185, 4.3, "Figure", "plt.figure") |
| 79 | +annotate(3.495, -0.10, "Minor tick label", "ax.xaxis.set_minor_formatter()") |
| 80 | +annotate(-0.03, 1.05, "Major tick", "ax.yaxis.set_major_locator()") |
| 81 | +annotate(0.00, 3.75, "Minor tick", "ax.yaxis.set_minor_locator()") |
| 82 | +annotate(-0.15, 3.00, "Major tick label", "ax.yaxis.set_major_formatter()") |
| 83 | +annotate(1.68, -0.37, "xlabel", "ax.set_xlabel()") |
| 84 | +annotate(-0.35, 1.68, "ylabel", "ax.set_ylabel()") |
| 85 | +annotate(1.52, 4.15, "Title", "ax.set_title()") |
| 86 | +annotate(1.75, 2.80, "Line", "ax.plot()") |
| 87 | +annotate(2.25, 1.54, "Markers", "ax.scatter()") |
| 88 | +annotate(3.00, 3.00, "Grid", "ax.grid()") |
| 89 | +annotate(3.60, 3.62, "Legend", "ax.legend()") |
| 90 | +annotate(2.5, 0.55, "Axes", "fig.subplots()") |
| 91 | +annotate(4, 4.5, "Figure", "plt.figure()") |
93 | 92 | annotate(0.65, 0.01, "x Axis", "ax.xaxis")
|
94 | 93 | annotate(0, 0.44, "y Axis", "ax.yaxis")
|
95 | 94 | annotate(4.0, 0.7, "Spine", "ax.spines")
|
96 | 95 |
|
97 | 96 | # frame around figure
|
98 |
| -fig.patch.set(linewidth=10, edgecolor='0.5') |
| 97 | +fig.patch.set(linewidth=4, edgecolor='0.5') |
99 | 98 | plt.show()
|
100 | 99 |
|
101 | 100 |
|
|
0 commit comments