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を使ったデータ分析、機械学習
244
4
章 
Matplotlib
による可視化
4.6
 密度と等高線図
輪郭や色分けされた領域を使用して
3
次元データを
2
次元で表示すると便利な場合があります。
このために
Matplotlib
では
3
つの関数を提供しています。等高線図には
plt.contour
、塗りつぶし
た等高線図には
plt.contourf
、画像を表示する場合は
plt.imshow
です。この節では、これらを使っ
た例を紹介します。まず、
Jupyter notebook
を設定して使用する関数をインポートします。
In[1]: %matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('seaborn-white')
import numpy as np
4.6.1
3
次元関数の可視化
最初に関数
z
f
(
x
,
y
)
の等高線図を作成しましょう。関数
f
は次の関数を使います。(この関数
「2.5 配列の計算:ブロードキャスト」で、配列のブロードキャストを説明するのに使用しまし
た)。
In[2]: def f(x, y):
return np.sin(x) ** 10 + np.cos(10 + y * x) * np.cos(x)
等高線図は、
plt.contour
関数を使用して作成できます。
x
値のグリッド、
y
値のグリッド、
z
値のグリッドの
3
つの引数を取ります。
x
y
の値はプロット上の位置を表し、
z
値は輪郭レベ
ルで表されます。このようなデータを準備するには、
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