2012-08-09 41 views
1

我剛剛在運行ubuntu 10.04 LTS的服務器上將matplotlib更新爲1.1.0,以便與熊貓更好地發揮作用。熊貓根據不同版本的matplotlib的功能轉換我的索引。我在另一臺服務器上安裝了「easyinstall -U matplotlib」和「pip install -U matplotlib」。版本升級後matplotlib中沒有繪圖

我不能在任何以前的工作腳本或ipython中進行繪圖。 show()已停止在pylab中工作。有人能指出我可能被打破的方向嗎?

我從matplotlib網站下載了以下測試腳本「simple_plot.py」,並在首次刪除我的config目錄後在各種服務器上測試了它。

from pylab import * 
plot([1,2,3]) 
show() 

simple_plot產生是在<版本上運行的所有服務器= 0.99在一塊土地上,但對1.1版本沒有輸出。

這裏是一臺服務器上調試輸出不起作用:

$HOME=/home/michael 
CONFIGDIR=/home/michael/.matplotlib 
matplotlib data path /usr/local/lib/python2.6/dist-packages/matplotlib-1.1.0-py2.6-linux-x86_64.egg/matplotlib/mpl-data 
loaded rc file /usr/local/lib/python2.6/dist-packages/matplotlib-1.1.0-py2.6-linux-x86_64.egg/matplotlib/mpl-data/matplotlibrc 
matplotlib version 1.1.0 
verbose.level debug 
interactive is False 
platform is linux2 
Using fontManager instance from /home/michael/.matplotlib/fontList.cache 
backend agg version v2.2 
python version:2.6.5 
findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium to Bitstream Vera Sans (/usr/local/lib/python2.6/dist-packages/matplotlib-1.1.0-py2.6-linux- x86_64.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf) with score of 0.000000 

回答

1

您正在使用AGG的後端,這並不在屏幕上顯示的數字。這是matplotlib的默認值。您需要在matplotlib配置文件中更改後端(通常爲〜/ .matplotlib/matplotlibrc)。尋找部分:

backend  : Agg 

而且與一個替換 'AGG的':GTKAgg,Qt4Agg,TkAgg,WXAgg。您可能沒有在系統中安裝所有這些(或任何!),因此請嘗試一種方法。

如果沒有文件〜/ .matplotlib/matplotlibrc,然後將它從你的主配置複製:

cp /usr/local/lib/python2.6/dist-packages/matplotlib-1.1.0-py2.6-linux-x86_64.egg/matplotlib/mpl-data/matplotlibrc ~/.matplotlib/matplotlibrc 
+0

謝謝。我沒有配置文件〜/ .matplotlib/matplotlibrc。它看起來像默認後端更改爲1.0時。 謝謝。 – 2012-08-09 23:23:44