Skip to content

Fix duplicate shared boxplot tick labels#630

Merged
cvanelteren merged 5 commits intomainfrom
fix/boxplot-shared-xticks-628
Mar 19, 2026
Merged

Fix duplicate shared boxplot tick labels#630
cvanelteren merged 5 commits intomainfrom
fix/boxplot-shared-xticks-628

Conversation

@cvanelteren
Copy link
Collaborator

This fixes the shared-axis boxplot regression where repeated boxplot calls on axes with sharex >= 2 could append the same fixed tick labels multiple times, making the x tick labels appear duplicated or bold. The boxplot wrapper now avoids Matplotlib's appending tick manager on already shared axes and applies the intended tick labels once, with a regression test covering the reported case. Closes #628.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a regression in UltraPlot’s boxplot wrapper where repeated boxplot() calls on axes with stronger x-axis sharing (sharex >= 2) could accumulate duplicate fixed tick labels, causing duplicated/bold x tick label rendering. Adds a regression test for the reported scenario (issue #628).

Changes:

  • Add shared-axis detection for boxplot tick management and bypass Matplotlib’s appending tick-manager on shared tickers.
  • Install fixed tick locator/formatter once per call for shared axes to prevent duplicated tick labels.
  • Add a regression test ensuring shared x axes do not end up with duplicated tick label text.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ultraplot/axes/plot.py Avoid Matplotlib’s tick-manager path on shared tick axes and apply fixed ticks/labels without duplication.
ultraplot/tests/test_plot.py Adds regression test covering repeated boxplot calls under sharex=2 to ensure tick labels don’t duplicate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@cvanelteren
Copy link
Collaborator Author

Manual inspection looks good. Merging.

@cvanelteren cvanelteren merged commit 7114cba into main Mar 19, 2026
14 of 17 checks passed
@cvanelteren cvanelteren deleted the fix/boxplot-shared-xticks-628 branch March 19, 2026 09:34
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.

Boxplots have duplicate xtick labels when enabling x axis sharing

2 participants