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を使ったデータ分析、機械学習
256
4
章 
Matplotlib
による可視化
4.8.2
 点サイズの凡例
時には、デフォルトの凡例では不十分な場合もあります。例えば、データの特徴を点の大きさで
示すとして、その凡例を作成したいとします。ここではカリフォルニアの都市人口を示すために、
散布図の点の大きさで示した例を作ります。点の大きさの尺度を表す凡例が欲しいので、まずラベ
ルなしのデータを項目なしでプロットすることでこれを実現します( 4-47
1
In[9]: import pandas as pd
cities = pd.read_csv('data/california_cities.csv')
 
# Extract the data we're interested in
着目しているデータを抜き出す
lat, lon = cities['latd'], cities['longd']
population, area = cities['population_total'], cities['area_total_km2']
 
# Scatter the points, using size and color but no label
plt.scatter(lon, lat, label=None,
各地点に色と大きさを指定した散布図を
プロットする、ラベルは付加しない
c=np.log10(population), cmap='viridis',
s=area, linewidth=0, alpha=0.5) ...
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