2016-08-01 40 views
2

我試圖在安德魯斯情節中繪製一些國家的數據,但數字'1e12'不斷顯示在右上角,我不知道爲什麼它存在或如何擺脫它。這裏是情節本身:安德魯斯繪製在角落裏的隨機數字

enter image description here

這是我用來做它的代碼,非常標準的安卓劇情:

import pandas as pd 
import matplotlib.pyplot as plt 
from pandas.tools.plotting import radviz 
from pandas.tools.plotting import table 
from pandas import read_csv 
from pandas.tools.plotting import andrews_curves 
import os 

filepath ="/Users/.../DefenseAndrews.csv" 
os.chdir(os.getcwd()) 
os.getcwd() 
dc = read_csv(filepath, 
header=0, usecols=['Country','GDP','ME','GE','Trade','PopDensity']) 

plt.figure() 
andrews_curves(dc, 'Country') 
plt.legend(loc='best', bbox_to_anchor=(1.0, 4.3)) 
plt.savefig('figure4_AndrewsPlot.eps', format='eps', dpi=1200) 
plt.show() 

我以前的解決方案是剛剛打開保存並手動刪除它在藝術節目中。但是,現在我必須創建圖像作爲一個eps文件,我不能在事後編輯。任何幫助或建議將不勝感激。

+0

請至少提供您的csv文件的片段 –

回答

1

該值是軸上的比例。你必須將你的數據分成大約1e11。用虹膜數據查看下面的例子。

iris data linked here

from pandas.tools.plotting import andrews_curves 

data1 = pd.read_csv('iris.csv') 
data2 = data1.copy() 
data2.iloc[:, :4] *= 1e11 

fig, axes = plt.subplots(1, 2, figsize=(10, 5)) 
andrews_curves(data1, 'Name', ax=axes[0]) 
andrews_curves(data2, 'Name', ax=axes[1]) 

enter image description here

你會發現左邊的圖沒有這個號數,而右邊的圖表一樣。我有意將右邊的數據乘以1e11。

+0

哦,你是一個可愛的人,謝謝你! – Roger