Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use constant gap for rank plots #2180

Merged
merged 5 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

### Maintenance and fixes
- Fix dimension ordering for `plot_trace` with divergences ([2151](https://github.com/arviz-devs/arviz/pull/2151))
- Fix gap for `plot_trace` with option `kind="rank_bars"` ([2180](https://github.com/arviz-devs/arviz/pull/2180))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this ended up in the 0.14 section instead of the unreleased, other than that it is good to merge



## v0.13.0 (2022 Oct 22)

Expand Down
2 changes: 1 addition & 1 deletion arviz/plots/backends/matplotlib/rankplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def plot_rank(
all_counts = np.empty((len(ranks), len(bin_ary) - 1))
for idx, row in enumerate(ranks):
_, all_counts[idx], _ = histogram(row, bins=bin_ary)
gap = all_counts.max() * 1.05
gap = 2 / ranks.size
width = bin_ary[1] - bin_ary[0]

bar_kwargs.setdefault("width", width)
Expand Down
2 changes: 2 additions & 0 deletions arviz/plots/backends/matplotlib/traceplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def plot_trace(
fill_kwargs = matplotlib_kwarg_dealiaser(fill_kwargs, "fill_between")
rug_kwargs = matplotlib_kwarg_dealiaser(rug_kwargs, "scatter")
rank_kwargs = matplotlib_kwarg_dealiaser(rank_kwargs, "bar")
if compact:
rank_kwargs.setdefault("bar_kwargs", {"alpha": 0.2})
aloctavodia marked this conversation as resolved.
Show resolved Hide resolved

textsize = plot_kwargs.pop("textsize", 10)

Expand Down