Figure クラス

Figure クラス (matplotlib.figure モジュール)

[APIドキュメント]

class Figure(Artist)

すべてのプロット要素の中の最上位のコンテナです。

インスタンスメソッド

add_subplot

@ [APIドキュメント]

add_subplot(*args, **kwargs)

  • add_subplot(nrows, ncols, index, **kwargs)
  • add_subplot(pos, **kwargs)
  • add_subplot(ax)
  • add_subplot()
  • 引数
    • *args
      • nrows, ncols, index : <int>
      • pos : <int>
        • FigureオブジェクトのどこにAxesオブジェクトを追加するかを定めます。
        • 例えば、Figureオブジェクトを2行、3列に区切って、左上から右下に向かってカウントしたときに4番目の位置にAxesオブジェクトを配置する場合は、以下の2通りの指定の仕方があります。
          • nrow = 2, ncols = 3, index = 4
          • pos = 234 (この場合は、10以上の数を指定することはできません)
      • ax : 既存のAxesオブジェクトをFigureオブジェクトに追加します <Axes>
    • **kwargs
      • others : Axesクラスの設定項目(プロパティ)を指定できます
  • 戻り値
    • return : 追加されたAxesオブジェクト <Axes>

Figureオブジェクトのプロット配列の1つとして、Axesオブジェクトを追加します。Axesオブジェクトが引数に指定されていない場合は、新規作成されます。

autofmt_xdate

@ [APIドキュメント]

autofmt_xdate(bottom=0.2, rotation=30, ha=’right’, which=’major’)

  • 引数
    • bottom:<float>
    • rotation:軸ラベルを回転させる角度 <float>
    • ha:軸ラベルをどこにそろえるか <{‘left’, ‘center’, ‘right’}>
    • which:どの軸ラベルを回転させるか <{‘major’, ‘minor’, ‘both’}>
  • 戻り値:なし

X軸の日付のラベルを重ならないように、回転させて右揃えになるように調整します。

subplots_adjust

@ [APIドキュメント]

subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)

  • 引数
    • left:グラフの左端からの位置 <float>
    • bottom:グラフの下端からの位置 <float>
    • right:グラフの右端からの位置 <float>
    • top:グラフの上端からの位置 <float>
    • wspace:グラフ同士の横方向の間隔 <float>
    • hspace:グラフ同士の縦方向の間隔 <float>
  • 戻り値:なし

Figureの中でのグラフの位置を調節します。デフォルト値はrcParams[“figure.subplot.[name]”]で定められています。