【发布时间】:2011-02-20 17:50:24
【问题描述】:
我第一次尝试使用 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 完全陌生,我确信我犯了一些愚蠢的简单错误。请赐教!非常感谢您的帮助!
【问题讨论】:
标签: latex matplotlib scipy tex