Skip to content

Commit

Permalink
Fix bug on seaborn plot
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellDash332 committed Jan 31, 2024
1 parent 056356f commit 2adabe8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions autokattis/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ def plot_problems(self, filepath=None, show_solved=True, show_partial=True, show
palette = {'Easy': '#39a137', 'Medium': '#ffbe00', 'Hard': '#ff411a', 'N/A': 'gray'}
for c in [*palette]:
if c not in categories: del palette[c]
hist = sns.histplot(data=df, x='difficulty', hue='category', multiple='stack', binwidth=0.1, hue_order=hue_order, palette=palette)
diff_lo = math.floor(min([d for d in df.difficulty if d], default=0))
diff_hi = math.ceil(max([d for d in df.difficulty if d], default=0))
hist = sns.histplot(data=df, x='difficulty', hue='category', multiple='stack', bins=[i/10 for i in range(10*diff_lo, 10*diff_hi+1)], hue_order=hue_order, palette=palette)
hist.set(title=f'Solved Kattis Problems by {self.user} ({df.shape[0]})', xlabel='Difficulty')
plt.legend(title='Category', loc='upper right', labels=hue_order[::-1])
plt.xticks([*range(math.floor(min([d for d in df.difficulty if d], default=0)), math.ceil(max([d for d in df.difficulty if d], default=0))+1)])
plt.xticks([*range(diff_lo, diff_hi+1)])
if filepath != None:
plt.savefig(filepath)
print(f'Saved to {filepath}')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup_args = dict(
name='autokattis',
version='1.6.1',
version='1.6.2',
description='Updated Kattis API wrapper',
long_description_content_type="text/markdown",
long_description=README,
Expand Down

0 comments on commit 2adabe8

Please # to comment.