Skip to content

Fix int/list has no size error, for bar plot of pd.Series#732

Merged
cvanelteren merged 4 commits into
Ultraplot:mainfrom
gepcel:fix-inthasnosize
Jun 2, 2026
Merged

Fix int/list has no size error, for bar plot of pd.Series#732
cvanelteren merged 4 commits into
Ultraplot:mainfrom
gepcel:fix-inthasnosize

Conversation

@gepcel
Copy link
Copy Markdown
Collaborator

@gepcel gepcel commented May 24, 2026

Should fix #731, wait for @cvanelteren

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cvanelteren
Copy link
Copy Markdown
Collaborator

While this line would remove the error it does not fix the actual error. I think we can make this easier by doing some input validation. Will update this PR.

Issue Ultraplot#731 reproduces because pandas dispatches Series.plot(kind="barh")
with a scalar ``bottom`` (or ``left``), which flowed unchanged through
``_apply_bar``: ``_not_none(b, np.array([0.0]))`` returns the scalar as
soon as it is not ``None``, then ``for y in (b, b + h)`` later passed it
to ``_inbounds_xylim`` where ``x.size`` / ``y.size`` raised
``AttributeError`` for ints and lists.

Normalize ``b`` to an ndarray once via ``np.atleast_1d`` so all
downstream code sees an array, and restore the original ``x.size``
invariant in ``_inbounds_xylim`` (the defensive ``getattr`` only masked
the symptom). Add a regression test exercising both direct scalar
``bottom``/``left`` and the original ``pd.Series.plot(kind="barh")``
reproducer.
@cvanelteren cvanelteren merged commit e716871 into Ultraplot:main Jun 2, 2026
5 of 7 checks passed
@cvanelteren
Copy link
Copy Markdown
Collaborator

Thanks for all the work @gepcel

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.

imcompatible between pandas barh plot and ultraplot

2 participants