Skip to content

[ENH]: Allow list of padding values for bar_label #29647

Closed

Description

@nhansendev

Problem

Sometimes when adding labels to bar plots the labels will overlap another item and need padding. In this example the label "300" (column D) is too low and overlaps other text. Ideally I could just provide padding as a list to bar_label so that I can target this specific label (instead of the current all-or-nothing float value):
Image

With manually added labels I can add padding to just the desired label, but it would be nice as a built-in option:
Image

Proposed solution

Add logic to check if the padding parameter of bar_label is an appropriate-length iterable and apply padding accordingly.

Activity

  1. added
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Feb 24, 2025
  2. github-actions commented on Feb 24, 2025

    @github-actions

    Good first issue - notes for new contributors

    This issue is suited to new contributors because it does not require understanding of the
    Matplotlib internals. To get started, please see our contributing
    guide
    .

    We do not assign issues. Check the Development section in the sidebar for linked pull
    requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please
    collaborate on the work by reviewing it rather than duplicating it in a competing PR.

    If something is unclear, please reach out on any of our communication
    channels
    .

  3. hasanrashid commented on Feb 24, 2025

    @hasanrashid
    Contributor

    I can work on this.

  4. QianZhang19 commented on Feb 27, 2025

    @QianZhang19
    Contributor

    Hi, I'd like to work on this issue! Could you assign it to me? Thanks

  5. brifore13 commented on Feb 27, 2025

    @brifore13
    Contributor

    Hi, I am a first time contributor and can work on this issue. It does not look like there is an open PR for this issue yet.

  6. timhoffm commented on Feb 27, 2025

    @timhoffm
    Member

    @QianZhang19 Per our policy we do not assign issues. Issues are claimed by opening a pull request.

    @brifore13 thanks for your interest. We have no formal regulation when there are multiple stating interest but no PR yet. To prevent duplicate work and not "snatching" the topic. I suggest to leave a courtsy time of 24h after @QianZhang19's statement of interest. If no PR is in by then, you are welcome to provide one.

  7. hasanrashid commented on Feb 27, 2025

    @hasanrashid
    Contributor

    Hey folks, sorry for letting this one sit. I got something else going on. I will bow out of this for now. I may not get to a PR until tomorrow. If this is still open over the weekend, I will create one. Good luck

  8. Sourabh-Kumar7 commented on Feb 28, 2025

    @Sourabh-Kumar7

    Hi, I would like to work on this. Hi all, I'd like to work on this issue. I'll wait 24 hours for @brifore13 and @QianZhang19 to submit a PR. If there's no PR by then, I'll proceed with the fix. Thanks!

  9. maederan201 commented on Feb 28, 2025

    @maederan201

    It seems that everyone is keen to work on this. I have a fix ready, since I needed this feature for one of my plots. I'll do the same as @Sourabh-Kumar7 and wait for a day before submitting the PR

  10. QianZhang19 commented on Feb 28, 2025

    @QianZhang19
    Contributor

    @maederan201 Since you already have a fix ready and need this feature, I won’t be working on this issue. Looking forward to seeing your PR!

  11. added this to the v3.11.0 milestone on Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    New feature🌱 Good first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions