|
23 | 23 | "source": [ |
24 | 24 | "from maxplotlib import Canvas\n", |
25 | 25 | "import numpy as np\n", |
26 | | - "\n", |
| 26 | + "%load_ext autoreload\n", |
| 27 | + "%autoreload 2" |
| 28 | + ] |
| 29 | + }, |
| 30 | + { |
| 31 | + "cell_type": "code", |
| 32 | + "execution_count": null, |
| 33 | + "id": "2", |
| 34 | + "metadata": {}, |
| 35 | + "outputs": [], |
| 36 | + "source": [ |
27 | 37 | "# Create a 1×2 canvas with custom width\n", |
28 | 38 | "x = np.linspace(0, 2 * np.pi, 200)\n", |
29 | 39 | "canvas, (ax1, ax2) = Canvas.subplots(ncols=2, width=\"10cm\", ratio=0.3)\n", |
30 | 40 | "\n", |
31 | 41 | "# Left subplot: sine wave\n", |
32 | | - "ax1.plot(x, np.sin(x), color=\"royalblue\", label=\"sin(x)\")\n", |
| 42 | + "ax1.plot(x, np.sin(x), color=\"royalblue\", label=\"sin(x)\", linewidth=1.5)\n", |
33 | 43 | "ax1.set_title(\"sin(x)\")\n", |
34 | 44 | "ax1.set_xlabel(\"x\")\n", |
35 | 45 | "ax1.set_ylabel(\"amplitude\")\n", |
36 | 46 | "\n", |
37 | 47 | "# Right subplot: cosine wave\n", |
38 | | - "ax2.plot(x, np.cos(x), color=\"tomato\", label=\"cos(x)\")\n", |
| 48 | + "ax2.plot(x, np.cos(x), color=\"tomato\", label=\"cos(x)\", linewidth=1.5)\n", |
39 | 49 | "ax2.set_title(\"cos(x)\")\n", |
40 | 50 | "ax2.set_xlabel(\"x\")\n", |
41 | 51 | "\n", |
|
48 | 58 | }, |
49 | 59 | { |
50 | 60 | "cell_type": "markdown", |
51 | | - "id": "2", |
| 61 | + "id": "3", |
52 | 62 | "metadata": {}, |
53 | 63 | "source": [ |
54 | 64 | "## 1×3 Layout: Multiple Functions\n", |
|
59 | 69 | { |
60 | 70 | "cell_type": "code", |
61 | 71 | "execution_count": null, |
62 | | - "id": "3", |
| 72 | + "id": "4", |
63 | 73 | "metadata": {}, |
64 | 74 | "outputs": [], |
65 | 75 | "source": [ |
|
69 | 79 | "# Three different functions\n", |
70 | 80 | "x = np.linspace(0, 2 * np.pi, 100)\n", |
71 | 81 | "\n", |
72 | | - "axes[0].plot(x, np.sin(x), color=\"royalblue\")\n", |
| 82 | + "axes[0].plot(x, np.sin(x), color=\"blue\")\n", |
73 | 83 | "axes[0].set_title(\"sin(x)\")\n", |
74 | 84 | "axes[0].set_xlabel(\"x\")\n", |
75 | 85 | "\n", |
76 | | - "axes[1].plot(x, np.cos(x), color=\"tomato\")\n", |
| 86 | + "axes[1].plot(x, np.cos(x), color=\"red\")\n", |
77 | 87 | "axes[1].set_title(\"cos(x)\")\n", |
78 | 88 | "axes[1].set_xlabel(\"x\")\n", |
79 | 89 | "\n", |
80 | | - "axes[2].plot(x, np.tan(x), color=\"seagreen\")\n", |
| 90 | + "axes[2].plot(x, np.tan(x), color=\"darkgreen\")\n", |
81 | 91 | "axes[2].set_title(\"tan(x)\")\n", |
82 | 92 | "axes[2].set_xlabel(\"x\")\n", |
83 | 93 | "axes[2].set_ylim(-5, 5) # Limit y-range for tan\n", |
84 | 94 | "\n", |
85 | 95 | "canvas.suptitle(\"1 × 3 Layout: Three Trigonometric Functions\")\n", |
86 | | - "result = canvas.show(backend=\"tikzfigure\")" |
| 96 | + "result = canvas.show(backend=\"tikzfigure\")\n", |
| 97 | + "print(result)" |
87 | 98 | ] |
88 | 99 | }, |
89 | 100 | { |
90 | 101 | "cell_type": "markdown", |
91 | | - "id": "4", |
| 102 | + "id": "5", |
92 | 103 | "metadata": {}, |
93 | 104 | "source": [ |
94 | 105 | "## Important Notes\n", |
|
100 | 111 | ] |
101 | 112 | } |
102 | 113 | ], |
103 | | - "metadata": {}, |
| 114 | + "metadata": { |
| 115 | + "kernelspec": { |
| 116 | + "display_name": ".venv", |
| 117 | + "language": "python", |
| 118 | + "name": "python3" |
| 119 | + }, |
| 120 | + "language_info": { |
| 121 | + "codemirror_mode": { |
| 122 | + "name": "ipython", |
| 123 | + "version": 3 |
| 124 | + }, |
| 125 | + "file_extension": ".py", |
| 126 | + "mimetype": "text/x-python", |
| 127 | + "name": "python", |
| 128 | + "nbconvert_exporter": "python", |
| 129 | + "pygments_lexer": "ipython3", |
| 130 | + "version": "3.13.3" |
| 131 | + } |
| 132 | + }, |
104 | 133 | "nbformat": 4, |
105 | 134 | "nbformat_minor": 5 |
106 | 135 | } |
0 commit comments