1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Python グラフを分けて表示(メモ)

Posted at

#Pythonで1つにグラフ表示されていたのを2つに分けたい

Pythonでグラフを無意識に書くと縦軸の値を一緒に使うので値がすごく大きいグラフと小さいグラフが一緒に表示される.

image.png

こんな感じ(多分僕だけかもしれませんが…)

ちなみに青の凡例が生データ,オレンジの凡例が傾きになる.

これを二つのグラフ表示に分ける.

#subplot

グラフ上に規則的に複数表示させるためにsubplot関数を使った.

subplot(行数, 列数, プロット番号)

行数☓列数でfigureが分割される.プロット番号は1行目から右方向に番号が増えるようになる.ちなみに今回使ったのは2行1列なのでプロット番号は

| プロット番号 |
| :----: | ---- |
| 1 | TD |
| 2 | TD |

となる.

実際のコードは

#figureの作成
fig = plt.figure()
plt.subplot(2,1,1)
plt.plot(data7)#生データ

…

plt.subplot(2,1,2)
plt.plot(huge7)#傾き

途中省略してるところあり.実際の結果は
image.png

で,上が生データ,下が傾きである.縦軸がメモリ粗めなのでこれから加工する必要がある.

とりあえず自分用のメモ書きになってるので今回のキーのところだけ書いてみた.

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?