Skip to content

Fix negative margin expansion in rugplot causing clipped histogram bars#3962

Open
ananyaparihar wants to merge 1 commit into
mwaskom:masterfrom
ananyaparihar:fix-rugplot-jointplot-clipping
Open

Fix negative margin expansion in rugplot causing clipped histogram bars#3962
ananyaparihar wants to merge 1 commit into
mwaskom:masterfrom
ananyaparihar:fix-rugplot-jointplot-clipping

Conversation

@ananyaparihar

Copy link
Copy Markdown

Fixes #3890

plot_rug's margin expansion used height directly rather than its absolute value. When a negative height is passed (common when drawing rugs below the axis with clip_on=False), this shrank the axis margins instead of expanding them — clipping marginal histogram bars in jointplot.

Confirmed with the issue's reproduction case: before the fix, ax_marg_x ylim shrank from (0, 50.4) to (12, 36) after adding the rug; after the fix, it correctly expands to (0, 64.8).

Ran the full test suite for this file — all relevant tests pass. Two unrelated pre-existing failures occur due to a local Tk/Tcl backend issue, unrelated to this change.

expand_margins used the signed height value directly, causing
negative heights (used for below-axis rugs with clip_on=False)
to shrink axis margins instead of expanding them. This clipped
marginal histogram bars in jointplot. Fixes mwaskom#3890.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When adding rugplot to jointplot histograms, the bars get cut off in the docs example

1 participant