[英]How to format tick labels to geo location format with python Matplotlib?
I am working with geo json and i have successfully drown a map according to geo json file with matplotlib and it show latitude and longitude as floating point notation such as 7.6 etc. 我正在使用geo json,我已经使用matplotlib根据geo json文件成功淹没了地图,并且它以7.6等浮点表示法显示了纬度和经度。
but my requirement is x and y axis tick labels should be format as below format.I searched in documentation but i haven't found good solution.Is there is any possible way to do that? 但我的要求是x和y轴刻度标签的格式应为以下格式。我在文档中进行了搜索,但找不到很好的解决方案。是否有任何可能的方法?
Actually i found an answer for this question. 其实我找到了这个问题的答案。 This kind of geo coordinates generation is not an easy task. 这种地理坐标生成并非易事。 then i substitute custom labels instead of thick values by using this. 然后我使用此标签代替自定义标签而不是粗略值。
labelsx = [item.get_text() for item in ax2.get_xticklabels()]
labelsx[1] = u'79°30\'0"E'
labelsx[2] = u'80°0\'0"E'
labelsx[3] = u'80°30\'0"E'
labelsx[4] = u'81°0\'0"E'
labelsx[5] = u'81°30\'0"E'
labelsx[6] = u'82°0\'0"E'
ax2.set_xticklabels(labelsx)
this not may be a good answer but , when thick labels represent same values this method is possible like this. 这可能不是一个很好的答案,但是,如果粗标签表示相同的值,则可以使用这种方法。 That's why i used it here. 这就是为什么我在这里使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.