我运行一个从html代码行中检索数据的脚本。然后,我将这些数据绘制在地图上。现在,我使用下面的脚本绘制我在地图上检索的所有数字,其中c.high0是我从html脚本中提取的数字。
for c in cities :
c.retrieveTemps()
long, lat = c.long, c.lat
x, y = map(float(long), float(lat))
plt.text(x, y, c.high0, fontsize=7, fontweight='bold')这就像它应该做的那样,但是,如果数字是>= 34,我只想绘制它们的数字。不管怎么说,也许在plt.text的范围内会有这样的做法吗?我很困惑。谢谢!
发布于 2013-09-12 04:00:47
那麽:
for c in cities :
c.retrieveTemps()
long, lat = c.long, c.lat
x, y = map(float(long), float(lat))
if c.high0 >= 34:
plt.text(x, y, c.high0, fontsize=7, fontweight='bold')如果你真的需要在plt线内这样做的话:
plt.text(x, y, c.high0 if c.high0 >= 34 else '', fontsize=7, fontweight='bold')https://stackoverflow.com/questions/18755092
复制相似问题