Skip to content Skip to sidebar Skip to footer

Reversing The R-axis On A Radar Chart Matplotlib

I am trying to make a radar chart using this code : import matplotlib.pyplot as plt import numpy as np import sys import pandas as pd from math import pi import seaborn as sns impo

Solution 1:

A starting point following your approach should be:

#test with a more eye-friendly dataset
tab1 = np.linspace(0,1,11)

#Experiment
tab1 = -tab1 + 1

N = len(tab1)

angles = [n / float(N) * 2 * pi for n in range(N)]
angles += angles[:0]

# Initialise the spider plot
ax = plt.subplot(111, polar=True)

ax.set_theta_offset(pi / 6)
ax.set_theta_direction(-1)

plt.xticks(angles[0:], tab1)
r=(0.3, 0.6, 0.9)
plt.yticks(r)

ax.set_rlabel_position(0)
ax.plot(angles, tab1, linewidth=5, linestyle='solid', color='blue')

plt.show()

with the "experiment" being a multiplication by -1 and the addition of 1 to shift back the values to the [0,1] interval (if you don't shift the data, the tuple that you indicated as x might be out of the range of the datapoints in tab1).

EDIT: You might also want to check improvements to the polar plot introduced in Matplotlib 2.1

Post a Comment for "Reversing The R-axis On A Radar Chart Matplotlib"