Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Setcliponaxis: false by default for bar traces withtext andtextposition: 'auto' or'outside'#7558

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
emilykl wants to merge5 commits intomaster
base:master
Choose a base branch
Loading
fromcliponaxis-false-bars

Conversation

@emilykl
Copy link
Contributor

@emilyklemilykl commentedSep 16, 2025
edited
Loading

Description

Mitigation for#2001 /#2000

Normally thecliponaxis trace parameter istrue by default, meaning that text outside the plotted area is clipped.

However, since text is not taken into account when dtermining the axis range, this means that bar text placed outside the bar is almost always clipped by default, which is ugly.

This PR modifies the behavior of thecliponaxis parameter such that it is set tofalse by default in the following scenario:

  • A bar trace has a value supplied fortext, ANDtextposition is set to'auto' or'outside'

This results in text outside bars no longer being clipped at the default axis range.

Screenshots

Before

Screenshot 2025-09-15 at 12 31 04 PM

After

Screenshot 2025-09-16 at 1 49 58 PM

Caveats

  • Does not change behavior whentextposition is set to'auto' (the default). Auto textpositiontypically places text inside the bar, but may place it outside occasionally if there is not enough space inside. So there is a (relatively rare) edge case where text could still be clipped. Updated: Now applies to both'auto' and'outside'
  • Does not change clipping behavior for trace types other than'bar'. We may want to extend this behavior to other trace types in the future if there is demand, but I figured a more targeted change makes more sense to start with.
  • For traces with negative bars (and an x-axis on the bottom of the plot), this change can cause the bar text to overlap the axis tick labels (see image below). This can be avoided by manually settingcliponaxis: true. (I wonder if perhaps we should keep the defaultcliponaxis: true when there are negative bars; however this risks getting into a really twisty maze of edge cases where we have to consider not only the bar values, but also the axis direction as well as which side of the plot the ticks are drawn on).
Screenshot 2025-09-16 at 4 03 01 PM

Copy link
Contributor

@camdecostercamdecoster left a comment

Choose a reason for hiding this comment

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

This seems like a reasonable first step to fix these issues. Could you add a draftlog please?

emilykl reacted with thumbs up emoji
@alexjohnson-kobold
Copy link

Does not change behavior whentextposition is set to'auto' (the default). Auto textposition typically places text inside the bar, but may place it outside occasionally if there is not enough space inside. So there is a (relatively rare) edge case where text could still be clipped.

What would be the downside of extending this to'auto' as well? Feels like there's very little likelihood of other items besides bar text being affected (mostly just scatter markers, but using these together with bars is rare), and because that's the default even if it requires another condition (not enough space inside the bar) it feels like it'll hit as many people or more thantextposition: 'outside'. So I'd allow it with'auto' as well.

I wonder if perhaps we should keep the defaultcliponaxis: true when there are negative bars; however this risks getting into a really twisty maze of edge cases where we have to consider not only the bar values, but also the axis direction as well as which side of the plot the ticks are drawn on

Agreed, don't go down that route. You don't want to do anything insidesupplyDefaults that requires looking at the contents of data arrays.

@emilykl
Copy link
ContributorAuthor

What would be the downside of extending this to'auto' as well?

@alexjohnson-kobold Good point! I'm happy with extending it to'auto' as well if you're in favor.

@emilyklemilykl changed the titleSetcliponaxis: false by default for bar traces withtext andtextposition: 'outside'Setcliponaxis: false by default for bar traces withtext andtextposition:'auto' or'outside'`Sep 16, 2025
@emilyklemilykl changed the titleSetcliponaxis: false by default for bar traces withtext andtextposition:'auto' or'outside'`Setcliponaxis: false by default for bar traces withtext andtextposition: 'auto' or'outside'Sep 16, 2025
@gvwilsongvwilson added P1needed for current cycle fixfixes something broken labelsSep 17, 2025
@KajalTomar
Copy link

HI,@emilykl wondering if this PR is being reviewed and merged in soon?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@camdecostercamdecostercamdecoster approved these changes

@alexcjohnsonalexcjohnsonAwaiting requested review from alexcjohnson

+1 more reviewer

@gvwilsongvwilsongvwilson approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@emilyklemilykl

Labels

fixfixes something brokenP1needed for current cycle

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@emilykl@alexjohnson-kobold@KajalTomar@camdecoster@gvwilson

[8]ページ先頭

©2009-2025 Movatter.jp