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.3
 単純な線グラフ
231
4.3.2
 プロットの制御:座標軸の範囲
Matplotlib
は軸の範囲を自動的かつ最適に選択しますが、場合によっては細かく制御したい場合
もあります。軸の範囲を調整する最も基本的な方法は、
plt.xlim()
plt.ylim()
メソッドを使用
することです( 4-12)。
In[9]: plt.plot(x, np.sin(x))
plt.xlim(-1, 11)
plt.ylim(-1.5, 1.5);
図4-12 座標軸範囲の制御例
何らかの理由でいずれかの軸を逆に表示したい場合は、単純に引数の順序を逆にします(
4-13)。
In[10]: plt.plot(x, np.sin(x))
plt.xlim(10, 0)
plt.ylim(1.2, -1.2);
図4-13 y軸を逆に表示
232
4
章 
Matplotlib
による可視化
関連する有用な関数に
plt.axis()
があります(
axes
e
axis
i
である点に注意が必要です
1
)。
plt.axis()
メソッドに
[xmin, xmax, ymin, ymax]
を指定するリストを渡すことで、
x
y
の範囲を
1
回の呼び出しで設定できます。
In[11]: plt.plot(x, np.sin(x))
plt.axis([-1, ...
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