diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 514ce69..6602e3e 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -53,8 +53,8 @@ "state": { "type": "markdown", "state": { - "file": "04. Programming/Machine Learning.md", - "mode": "preview", + "file": "04. Programming/Python/matplotlib.md", + "mode": "source", "source": true } } @@ -126,7 +126,7 @@ "state": { "type": "backlink", "state": { - "file": "04. Programming/Machine Learning.md", + "file": "04. Programming/Python/matplotlib.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -151,7 +151,7 @@ "state": { "type": "outline", "state": { - "file": "04. Programming/Machine Learning.md" + "file": "04. Programming/Python/matplotlib.md" } } }, @@ -204,8 +204,8 @@ }, "active": "1f1e98d771d9e088", "lastOpenFiles": [ - "05. 資料收集/讀書筆記/20230206 - 卡片盒筆記.md", "04. Programming/Machine Learning.md", + "05. 資料收集/讀書筆記/20230206 - 卡片盒筆記.md", "05. 資料收集/核心肌群訓練.md", "05. 資料收集/Capture One.md", "05. 資料收集/AI.md", diff --git a/04. Programming/Python/matplotlib.md b/04. Programming/Python/matplotlib.md index 2f5b31e..a09ca41 100644 --- a/04. Programming/Python/matplotlib.md +++ b/04. Programming/Python/matplotlib.md @@ -22,6 +22,19 @@ plt.xlabel( plt.gca().axes.get_xaxis().set_visible(False) ``` +## 畫2張圖 +```python +figure, axis = plt.subplots(2, 2) +``` +用 `plt.subplots()` 來指定要畫幾張圖,第一個參數是x軸的數量,第二個參數是y軸的數量 +`axis` 會是一個 array,可以用類似座標的方式來控制你要的圖,例如: +```python +axis[0, 0].set_title("Sine Function") +axis[0, 1].set_title("Cosine Function") +``` + +`figure` 則是指外圍的大圖。 + ## 畫2條線 ```python plt.plot(x, y1, label='sine curve',color='b')