Skip to content

Commit

Permalink
Black.
Browse files Browse the repository at this point in the history
  • Loading branch information
kklein committed Jan 2, 2024
1 parent f47fc4a commit 848c6d7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions monitoring/yearly.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,19 @@ def variety(df: pd.DataFrame) -> tuple[dict[int, dict[str, float]], dict[int, fl
entropies = {year: utils.kl(probabilities[year].values()) for year in years}
return (probabilities, entropies)


class Radar(object):
def __init__(self, figure, title, labels, rect=None):
if rect is None:
rect = [0.05, 0.05, 0.9, 0.9]

self.n = len(title)
self.angles = np.arange(0, 360, 360.0/self.n)
self.angles = np.arange(0, 360, 360.0 / self.n)

self.axes = [figure.add_axes(rect, projection='polar', label='axes%d' % i) for i in range(self.n)]
self.axes = [
figure.add_axes(rect, projection="polar", label="axes%d" % i)
for i in range(self.n)
]

self.ax = self.axes[0]
self.ax.set_thetagrids(self.angles, labels=title, fontsize=14)
Expand All @@ -69,16 +73,15 @@ def __init__(self, figure, title, labels, rect=None):
ax.xaxis.set_visible(False)

for ax, angle, label in zip(self.axes, self.angles, labels):
ax.set_rgrids([0.05, .25, .5, .75, 1], angle=angle, labels=label)
ax.spines['polar'].set_visible(False)
ax.set_rgrids([0.05, 0.25, 0.5, 0.75, 1], angle=angle, labels=label)
ax.spines["polar"].set_visible(False)
ax.set_ylim(0, 1)

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)


def fill(self, values, *args, **kw):
angle = np.deg2rad(np.r_[self.angles, self.angles[0]])
values = np.r_[values, values[0]]
Expand Down

0 comments on commit 848c6d7

Please sign in to comment.