Skip to content

Commit

Permalink
MAINT: Fix deprecated seaborn function calls
Browse files Browse the repository at this point in the history
Fix deprecated `seaborn` function calls: use `displot` or `histplot`
where applicable instead of `distplot`, since the latter will be removed
in `seaborn` v0.14.0.

Adapt the corresponding calls where necessary adding reasonable keyword
argument values.

Fixes:
```
This function has been deprecated and will be removed in seaborn v0.14.0.
It has been replaced by :func:`histplot` and :func:`displot`,
two functions with a modern API and many more capabilities.
```

Documentation:
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751

Co-authored-by: Chris Markiewicz <[email protected]>
  • Loading branch information
jhlegarreta and effigies committed Feb 19, 2025
1 parent 7320552 commit e69a319
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nireports/reportlets/nuisance.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def plot_fd(fd_file, fd_radius, mean_fd_dist=None, figsize=DINA4_LANDSCAPE):

if mean_fd_dist:
ax = fig.add_subplot(grid[1, :])
sns.distplot(mean_fd_dist, ax=ax)
sns.histplot(mean_fd_dist, kde=True, stat="density", kde_kws={"cut": 3}, ax=ax)
ax.set_xlabel("Mean Frame Displacement (over all subjects) [mm]")
mean_fd = fd_power.mean()
label = rf"$\overline{{\text{{FD}}}}$ = {mean_fd:g}"
Expand All @@ -93,11 +93,11 @@ def plot_dist(

gsp = GridSpec(2, 1)
ax = fig.add_subplot(gsp[0, 0])
sns.distplot(data.astype(np.double), kde=False, bins=100, ax=ax)
sns.displot(data.astype(np.double), kde=False, bins=100, ax=ax)
ax.set_xlabel(xlabel)

ax = fig.add_subplot(gsp[1, 0])
sns.distplot(np.array(distribution).astype(np.double), ax=ax)
sns.histplot(np.array(distribution, dtype="f8"), kde=True, stat="density", kde_kws={"cut": 3}, ax=ax)
cur_val = np.median(data)
label = f"{cur_val:g}"
plot_vline(cur_val, label, ax=ax)
Expand Down

0 comments on commit e69a319

Please sign in to comment.