2017-01-11 5 views
0

私は1996年から2015年までの竜巻データの分析に取り組んでいます。私は竜巻の数を州ごとの総資産損失と比較しています。MATPLOTLIB - プロットの縮尺を増やす

私は基本的なプロットを持っていますが、小さい数字があまりにも密接に束ねている一緒に

Tornado Plot

私が知りたいのですが、もう少しこれらを分散するように私はこれを拡張することができます方法です?

プロットのための私のコードは、私はX-ティックとy-ティックを設定して周りにプレイしましたが、それらは私がない限り(ちょうどより多くのダニを追加し、スケールを調整していないようです

count = tonadoes_1996_damage['count'] 
loss = tonadoes_1996_damage['total_loss'] 

max_tornado_count = tonadoes_1996_damage['count'].max() 
max_tornado_cnt_label = tonadoes_1996_damage[tonadoes_1996_damage['count'] == max_tornado_count].index.tolist()[0] 
max_tornado_cnt_x = tonadoes_1996_damage[tonadoes_1996_damage['count'] == max_tornado_count]['count'] 
max_tornado_cnt_y = tonadoes_1996_damage[tonadoes_1996_damage['count'] == max_tornado_count]['total_loss'] 

max_tornado_loss = tonadoes_1996_damage['total_loss'].max() 
max_tornado_loss_label = tonadoes_1996_damage[tonadoes_1996_damage['total_loss'] == max_tornado_loss].index.tolist()[0] 
max_tornado_loss_x = tonadoes_1996_damage[tonadoes_1996_damage['total_loss'] == max_tornado_loss]['count'] 
max_tornado_loss_y = tonadoes_1996_damage[tonadoes_1996_damage['total_loss'] == max_tornado_loss]['total_loss'] 

colors = np.random.rand(51) 
area = count 
plt.scatter(count, loss,s=area,c=colors,alpha=.5) 

xlab = "Number of Tornadoes [in thousands]" 
ylab = "Total Loss [in million USD]" 
title = "Total Property Loss Since 1996" 

plt.xlabel(xlab) 
plt.xlim(0, 3500) 

plt.ylabel(ylab) 
plt.ylim(0, 6000) 

plt.title(title) 
plt.grid(True) 

plt.text(max_tornado_cnt_x, max_tornado_cnt_y, max_tornado_cnt_label) 
plt.text(max_tornado_loss_x, max_tornado_loss_y, max_tornado_loss_label) 

plt.show() 

です何か間違ったことをやっている

+0

必要に応じてここから選択できます。 http://matplotlib.org/gallery.html。私は毎年の別のプロットの傾向を示すことを示唆し、それらを表示し、1996年から2015年までのすべてを1つのプロットで単純なグリッドとして表示し、結合した結果を表示することをお勧めします。 [this one](http://matplotlib.org/examples/axes_grid/simple_axesgrid.html) –

答えて

1

をあなたは、x軸用の対数スケールを使用することができ、これは、可視化を向上させます:。

fig = plt.figure(figsize=(11, 8)) 
ax = fig.add_subplot(1, 1, 1) 
ax.set_xscale('log') 
plt.scatter(count, loss,s=area,c=colors,alpha=.5) 
01: http://matplotlib.org/examples/pylab_examples/log_demo.html

ことのようなものを試してみてください

を入力し、それに応じてすべてのプロパティを追加します。

関連する問題