|
3 | 3 |
|
4 | 4 | plt.style.use("physics_plot.pp_base") |
5 | 5 |
|
| 6 | +x = np.linspace(0, 10, 1000) |
| 7 | +y = np.sin(5 * x) |
| 8 | + |
6 | 9 | fig, ax = plt.subplots(figsize=(4, 2), constrained_layout=True) |
7 | | -x = np.linspace(0, 10, 100) |
8 | | -y = np.sin(x) |
9 | | -ax.plot(x, y, label="Sine Wave") |
| 10 | +ax.plot(x, y, label=r"$y = \sin(5x)$") |
10 | 11 | ax.set_ylabel(r"$y(x)$") |
11 | 12 | ax.set_xlabel(r"$x$") |
12 | 13 | ax.legend(loc="upper right") |
13 | | -fig.suptitle(r"\texttt{figsize=(4, 2)}") |
| 14 | +fig.suptitle(r"Small Figure Size (4x2 inches), i.e., \texttt{figsize=(4, 2)}") |
14 | 15 | fig.savefig("mpl-size-sm.png") |
15 | 16 |
|
16 | | - |
17 | | -fig, ax = plt.subplots(figsize=(10, 5), constrained_layout=True) |
18 | | -x = np.linspace(0, 10, 100) |
19 | | -y = np.sin(x) |
20 | | -ax.plot(x, y, label="Sine Wave") |
| 17 | +fig, ax = plt.subplots(figsize=(8, 4), constrained_layout=True) |
| 18 | +ax.plot(x, y, label=r"$y = \sin(5x)$") |
21 | 19 | ax.set_ylabel(r"$y(x)$") |
22 | 20 | ax.set_xlabel(r"$x$") |
23 | 21 | ax.legend(loc="upper right") |
24 | | -fig.suptitle(r"\texttt{figsize=(10, 5)}") |
| 22 | +fig.suptitle(r"Large Figure Size (8x4 inches), i.e., \texttt{figsize=(8, 4)}") |
25 | 23 | fig.savefig("mpl-size-lg.png") |
0 commit comments