【发布时间】:2017-07-17 22:56:47
【问题描述】:
我正在使用 matplotlib 的底图工具包,但在将经线设为西正而不是东正时遇到了麻烦。底图甚至可以做到这一点吗?
除此之外,我在使用底图 API (https://matplotlib.org/basemap/api/basemap_api.html) 中给出的字符串格式说明时遇到了问题。我下面的代码 sn-p 使我的子午线向东,但我不确定如何遵循字符串格式说明,以便在每个刻度增量后有一个“E”或“W”。我究竟做错了什么?
self.meridians = self.basemap_ax.drawmeridians(numpy.around(numpy.degrees(coord_lons)),
labels=[1,0,0,1], labelstyle='+/-', fmt="%s", linewidth=0.5, color='gray', yoffset=5) % "E" #This will be either "E" or "W" depending on whether the meridians are east-positive or west-positive.
这是使用以下代码 sn-p 时经络的截图:
谢谢!感谢您的帮助。
【问题讨论】:
-
为什么不能只让东为正,西为负?
-
对于东经 90 度,您希望轴/刻度标签如何说
-
在正东,一切都应该在东方。我附上的截图是东正的,这就是增量从-180到+180的原因(从左到右)。在west-positive 中,一切都应该以west 为准。在这种情况下,增量应该(从左到右)从 +180 到 -180。
-
对于东经 90 度,我希望刻度标签显示“+90 E”。
-
labelstyle 参数似乎只允许加/减 前缀 或 E/W 前缀。 format 参数将一个函数作为参数 - 只需编写一个返回所需字符串的函数。
标签: python matplotlib matplotlib-basemap