13

From matplotlib examples:

import numpy as np
import seaborn as sbs
import matplotlib.pyplot as plt

r = np.arange(0, 3.0, 0.01)
theta = 2 * np.pi * r

ax = plt.subplot(111, polar=True)
ax.plot(theta, r, color='r', linewidth=3)
ax.set_rmax(2.0)
ax.grid(True)

ax.set_title("A line plot on a polar axis", va='bottom')
plt.show()

polar plot

How to move the radial tick labels (0.5, 1.0, 1.5, 2.0) to a different angle, say 120 deg?

alkamid
  • 6,970
  • 4
  • 28
  • 39

2 Answers2

24

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):

polar axis example ticks at 135 degrees

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

Ajean
  • 5,528
  • 14
  • 46
  • 69
2

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.

Community
  • 1
  • 1
rikisa
  • 301
  • 2
  • 9