使用Matplotlib的符号函数时,我收到以下错误:
ERROR: Data has no positive values, and therefore can not be log-scaled.
然而,我的数据在y维度上都是正面的:
presvals ~= [1000 990 980 970 960 950 940 930 920 910 900 ... 10]
下面是我如何调用代码:
import sharppy.sharptab.thermo as thermo
imageScale = 2
fig = plt.figure(figsize=(6.5875*imageScale, 6.2125*imageScale))
ax = fig.add_subplot(111)
ax.grid(True)
pmax = 1000
pmin = 10
dp = -10
presvals = np.arange(int(pmax), int(pmin)+dp, dp)
tw = []
for p in presvals:
tw.append(thermo.wetlift(1000., t, p))
ax.semilogy(tw, presvals, 'b-', alpha=.3)
我以前使用过这个精确的代码,它已经起作用了。有什么东西不见了吗?我试图格式化y轴,但没有任何帮助。如有任何方向可看,将不胜感激。你知道吗
对我来说,这个代码是有效的:
所以我认为问题出在
tw
的定义上,我无法重现。。。你知道吗相关问题 更多 >
编程相关推荐