Move radial tick labels on a polar plot in matplotlib

落爺英雄遲暮 提交于 2019-12-04 09:10:01

With version 1.4 or later, you can use "set_rlabel_position". e.g. to place the radial ticks a long a line at, say, 135 degrees:

ax.set_rlabel_position(135)

The relevant documentation is residing here, a bit hidden under "projections".

Adding the line above yields (I don't have seaborn so this has default matplotlib formatting):

Prior to 1.4, ax.set_rgrids can take an angle argument.

rikisa

I tried to run the example-code with the edit from @alkamid's answer, but eventually ended with an error

AttributeError: 'PolarAxesSubplot' object has no attribute 'set_rlabel_position'

My matplotlib version is 1.3.1. However I found this answer python matplolib polar chart x-axis label position with the following line of code:

ax.set_rgrids([5,10], angle=22)

This worked for me and produced the wanted output.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!