Skip to content

ENH: Add properties position_centers and tops to BarContainer #30226

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Jun 29, 2025

These will be useful if one wants to put additional things on the bars.

Noted in #30224 (comment), which this will simplify because instad of

    def center_top(rect):
        return rect.xy[0] + rect.get_width()/2, rect.xy[1] + rect.get_height()

    xy = np.array([center_top(r) for r in container.patches])
    ax.errorbar(xy[:,0], xy[:,1], yerr=yerr)

we can then simply do

    ax.errorbar(container.position_centers, container.tops, yerr=yerr)

Naming: The naming has to work for horizontal and vertical bars.

@timhoffm timhoffm force-pushed the barcontainer_props branch from 239dcf3 to 44e3dcd Compare June 29, 2025 22:17
@timhoffm timhoffm added this to the v3.11.0 milestone Jun 29, 2025
@timhoffm timhoffm force-pushed the barcontainer_props branch from 44e3dcd to df22b8a Compare June 30, 2025 14:37
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.

1 participant