Skip to Content
Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
book

Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

by Jake VanderPlas, 菊池 彰
May 2018
Intermediate to advanced
556 pages
13h 21m
Japanese
O'Reilly Japan, Inc.
Content preview from Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
4.10
 複数サブプロット
269
図4-62 間隔を調整したplt.subplot() の例
plt.subplots_adjust()
メソッドの
hspace
wspace
引数を使用して、図の高さと幅に沿った間
隔をサブプロットサイズの単位(この場合、間隔はサブプロットの幅と高さの
40
%)で指定しまし
た。
4.10.3
plt.subplots
:グリッド全体を一度に作成する
これまでに説明したアプローチでは、サブプロットのグリッドを作成する際、特に内側のプロッ
トに
x
軸ラベルと
y
軸ラベルを表示したくない場合に、非常に面倒になる可能性があります。こ
うした状況では、
plt.subplots()
が有益です(
subplot
の後にある
s
に注意してください)。この関
数は、単一のサブプロットを作成するのではなく、一回の呼び出しでサブプロットのグリッドを
作成し、
NumPy
配列として返します。引数は、行数と列数、およびオプションのキーワード引数
sharex
sharey
です。これらを使って軸と軸の間の関係を指定できます。
ここでは、同じ行のすべての軸が
y
軸を共有し、同じ列のすべての軸が
x
軸を共有する
2
×
3
リッドのサブプロットを作成します( 4-63)。
In[6]: fig, ax = plt.subplots(2, 3, sharex='col', sharey='row')
図4-63 x軸と y軸を共有した plt.subplots()
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Jake VanderPlas, 菊池 彰
初めてのGraphQL ―Webサービスを作って学ぶ新世代API

初めてのGraphQL ―Webサービスを作って学ぶ新世代API

Eve Porcello, Alex Banks, 尾崎 沙耶, あんどうやすし

Publisher Resources

ISBN: 9784873118413Other