0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

参考になった記事(グラフ描画)

0
Last updated at Posted at 2026-04-10

各コードの意味

x軸を縦に書く

plt.xticks(rotation=角度)

x軸を縦に書く(オブジェクト指向インターフェース)

ax.tick_params(axis="x", labelrotation=90)

2軸グラフを作成するときのfig,ax = subplots()のコードの意味

  • 結論: figureとaxisを同時に生成している。
  • Subplotとは何か:figure内に複数グラフを生成する事。
    • しかし、引数を省略してsubplots()にすると、subplotは1つ生成される

plt.plotとax.plotの違い(Pyplotインターフェースvsオブジェクト指向インターフェース)

  • 検索でヒットするコードは、Pyplotインターフェースかオブジェクト指向インターフェースかの2種類に大別されるが、どちらのインターフェースかを区別して理解することが重要
  • やりたいコードをそのままコピーしている内に、2つのインターフェースが混じっていることもあるので注意。
  • どちらのインターフェースを使うといいか?
    • Pyplotでは自動で設定してくれる部分もあり、簡単な描画には向いている
    • オブジェクト指向の方が見た目の微調整が可能なので、慣れると良い
  • Figure, axes, axis等はArtistsと呼ばれるオブジェクトである

Matplotlibの基本構造理解

Matplotlibの色見本

Groupbyで行単位の割合を計算する

データラベルのみを表示

  • ax.text()をforループで回して表示させれば良い

2個のヒストグラムを1つのaxesに描画する

データフレームに対してヒートマップを作成する(Styleを使用)

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?