I've adapted this sample: Matplotlib: Polar plot axis tick label location. I want to add tick marks next to the tick labels (A, B, C, D and E) along the thetagrid from the center of the polar axis to the thetagrid labels. Also, I want a round circle ending each line, directly below the thetagrid titles (TG01, TG02, etc.). You will see these tick labels and thetagrid titles in my code sample. Visually, here's part of line TG01 to demonstrate what I'm looking for:
Here's my current code:
import numpy as np
import matplotlib.pyplot as plt
class Radar(object):
def __init__(self, fig, titles, label, rect=None):
if rect is None:
rect = [0.05, 0.15, 0.95, 0.75]
self.n = len(titles)
self.angles = [a if a <=360. else a - 360. for a in np.arange(90, 90+360, 360.0/self.n)]
self.axes = [fig.add_axes(rect, projection="polar", label="axes%d" % i)
for i in range(self.n)]
self.ax = self.axes[0]
# Show the labels
self.ax.set_thetagrids(self.angles, labels=titles, fontsize=14, weight="bold", color="black")
for ax in self.axes[1:]:
ax.patch.set_visible(False)
ax.grid(False)
ax.xaxis.set_visible(False)
self.ax.yaxis.grid(False)
for ax, angle in zip(self.axes, self.angles):
ax.set_rgrids(range(1, 6), labels=label, angle=angle, fontsize=12)
# hide outer spine (circle)
ax.spines["polar"].set_visible(False)
ax.set_ylim(0, 6)
ax.xaxis.grid(True, color='black', linestyle='-')
def plot(self, values, *args, **kw):
angle = np.deg2rad(np.r_[self.angles, self.angles[0]])
values = np.r_[values, values[0]]
self.ax.plot(angle, values, *args, **kw)
fig = plt.figure(1)
titles = ['TG01', 'TG02', 'TG03', 'TG04', 'TG05', 'TG06']
label = list("ABCDE")
radar = Radar(fig, titles, label)
radar.plot([3.75, 3.25, 3.0, 2.75, 4.25, 3.5], "-", linewidth=2, color="b", alpha=.7, label="Data01")
radar.plot([3.25, 2.25, 2.25, 2.25, 1.5, 1.75],"-", linewidth=2, color="r", alpha=.7, label="Data02")
radar.ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.10),
fancybox=True, shadow=True, ncol=4)
plt.show()
And how the polar plot currently looks:
I took a close look at the ThetaTick objects retrieved with ax.xaxis.majorTicks. However, nothing I changed in the properties of a ThetaTick object changed the lines in the way I would like them to render.