简体   繁体   English

如何使用python Matplotlib将刻度标签格式化为地理位置格式?

[英]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.

相关问题 Matplotlib:指定刻度标签的浮点数格式 - Matplotlib: Specify format of floats for tick labels matplotlib format_major_ticks不检索轴刻度标签 - matplotlib format_major_ticks not retrieving axes tick labels 在 pandas.DataFrame.plot() 中格式化刻度标签而不导入 matplotlib - Format tick labels in a pandas.DataFrame.plot() without importing matplotlib Matplotlib:指定直方图刻度标签中 bin 值的格式 - Matplotlib: Specify format of bin values in a histogram's tick labels 如何在matplotlib python中删除刻度标签之间 - How to remove in between tick labels in matplotlib python 如何在 semilogx 子图中格式化刻度标签 - How to format tick labels in a semilogx subplots 如何使用 Pandas/Matplotlib 将 plot X 轴上的日期、Y 轴上的时间和 HH:MM 格式的当前时间作为刻度标签? - How to plot Date in X Axis, Time in Y axis with Pandas/Matplotlib and present time in HH:MM format as tick labels? 如何将 seaborn/matplotlib 轴刻度标签从数字格式化为数千或数百万? (125,436 到 125.4K) - How to format seaborn/matplotlib axis tick labels from number to thousands or Millions? (125,436 to 125.4K) Python / Matplotlib:如何在带有刻度但没有刻度标签的子图中绘制? - Python/Matplotlib: How to plot in a subplot with ticks but no tick labels? 如何在 Pandas 中格式化分位数条形图的 x 刻度标签 - How to format x tick labels of a quantiles barplot in pandas
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM