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を使ったデータ分析、機械学習
276
4
章 
Matplotlib
による可視化
と似ていますが、
Figure
(ここでは灰色のボックス)の左下からの位置を小数で与えます。
軸の範囲を変更すると、
transData
の座標だけが影響を受け、他の座標系は固定されたままであ
ることがわかります( 4-70)。
In[6]: ax.set_xlim(0, 2)
ax.set_ylim(-6, 6)
fig
図4-70 Matplotlibの座標系比較
対話的に軸の範囲を変更することで、この動きをより明らかにできます。
Jupyter notebook
このコードを実行している場合は、
%matplotlib inline
%matplotlib notebook
に変更すればメ
ニューを通してプロットを対話的に操作できます。
4.11.3
 矢印と注釈
単純な矢印は、目盛とテキストに次ぐ有用な注釈です。
Matplotlib
による矢印の描画は、思った
よりもずっと難しい作業です。
plt.arrow()
メソッドが用意されていますが、推奨しません。この
関数が作成する
SVG
オブジェクトの矢印は、プロットのアスペクト比に依存して変化するオブジェ
クトであり、その結果はおそらく意図したものとは異なります。代わりに、
plt.annotate()
を使
いましょう。このメソッドはテキストと矢印を作成し、非常に柔軟な指定が可能です。
annotate
の使用例を示します( 4-71)。
In[7]: %matplotlib inline
fig, ax = 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