我有我的第一次嘗試使用matplotlib和scipy來做我的數據的一些散點圖(太多變量,試圖一次看到許多事情)的一些問題。下面是我的一些代碼,工作相當好...麻煩在Matplotlib/Scipy等使用膠乳
import numpy
from scipy import *
import pylab
from matplotlib import *
import h5py
FileID = h5py.File('3DiPVDplot1.mat','r')
# (to view the contents of: list(FileID))
group = FileID['/']
CurrentsArray = group['Currents'].value
IvIIIarray = group['IvIII'].value
PFarray = group['PF'].value
growthTarray = group['growthT'].value
fig = pylab.figure()
ax = fig.add_subplot(111)
cax = ax.scatter(IvIIIarray, growthTarray, PFarray, CurrentsArray, alpha=0.75)
cbar = fig.colorbar(cax)
ax.set_xlabel('Cu/III')
ax.set_ylabel('Growth T')
ax.grid(True)
pylab.show()
我試圖修改代碼,包括乳膠字體和解釋,沒有它似乎爲我工作,但是。這裏有一個例子嘗試,沒有工作:
import numpy
from scipy import *
import pylab
from matplotlib import *
import h5py
rc('text', usetex=True)
rc('font', family='serif')
FileID = h5py.File('3DiPVDplot1.mat','r')
# (to view the contents of: list(FileID))
group = FileID['/']
CurrentsArray = group['Currents'].value
IvIIIarray = group['IvIII'].value
PFarray = group['PF'].value
growthTarray = group['growthT'].value
fig = pylab.figure()
ax = fig.add_subplot(111)
cax = ax.scatter(IvIIIarray, growthTarray, PFarray, CurrentsArray, alpha=0.75)
cbar = fig.colorbar(cax)
ax.set_xlabel(r'Cu/III')
ax.set_ylabel(r'Growth T')
ax.grid(True)
pylab.show()
我使用Fink安裝python26與SciPy的matplotlib等相應的包我一直在使用IPython的和人工的工作,而不是在Python腳本。
由於我對python和scipy完全陌生,所以我確信我正在犯一些愚蠢的簡單錯誤。請賜教!我非常感謝幫助!
史蒂夫!感謝您的評論,我感謝您對此的看法。我正在運行基於--verbose-helpful標誌的MacOSX後端(版本未知)。 更多信息 - matplotlib 0.99.0(fink上可用) tzinfo.py提供了一個棄用警告,因爲我相信即將發佈的py30版本。 – AllenH 2010-05-18 17:56:48
順便說一句,我應該提到我得到更簡單的情節乳膠輸出的實例,所以我試圖以這種方式追蹤它。由於某種原因,上面的代碼甚至不會輸出正常的散點圖 - 所以有些線路正在越過某處 - 我懷疑我使用python/scipy是不正確的。 – AllenH 2010-05-18 17:57:54