Skip to content

Commit

Permalink
Fix position_dodge2 width assignments
Browse files Browse the repository at this point in the history
fixes #772
  • Loading branch information
has2k1 committed Apr 22, 2024
1 parent b0da71e commit 2cfe165
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ title: Changelog
- Fix bug in [](:class:`~plotnine.stat_smooth`) where you could not set the
family when using a `glm`. ({{< issue 769 >}})

- Fix bug in [](:class:`~plotnine.position_dodge2`) the widths of the dodged
objects were mixed up. ({{< issue 772 >}})

## v0.13.4
(2024-04-03)

Expand Down
2 changes: 1 addition & 1 deletion plotnine/positions/position_dodge2.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def strategy(data, params):
# If n is None, preserve total widths of elements at
# each position by dividing widths by the number of
# elements at that position
n = data["xid"].value_counts().to_numpy()
n = data["xid"].value_counts(sort=False).to_numpy()
n = n[data.loc[:, "xid"] - 1]
data["new_width"] = (data["xmax"] - data["xmin"]) / n
else:
Expand Down

0 comments on commit 2cfe165

Please sign in to comment.