Skip to content
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

BUG: df.plot() multi-column subplots & title interaction #61019

Open
3 tasks done
eicchen02 opened this issue Feb 28, 2025 · 2 comments
Open
3 tasks done

BUG: df.plot() multi-column subplots & title interaction #61019

eicchen02 opened this issue Feb 28, 2025 · 2 comments
Assignees
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@eicchen02
Copy link

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import matplotlib.pyplot as plt
import pandas as pd

df = pd.DataFrame([(30, 10, 10), (20, 20, 20), (10, 30, 30)], columns=list('ABC'))
df.plot(subplots= [('A','B')],kind="bar", stacked=True, title=["A&B","C", "Needs another title despite no title here, removing this will error"])

print(df)
# print(pd.show_versions())
plt.show()

Issue Description

df.plot() has a hard coded check to make sure there are the same number of titles when using with the "subplots" parameter, however subplots allows for multiple columns to be represented on one plot, so there are scenarios where the number of plots is less than the check for the number of titles

Expected Behavior

You shouldn't need to purposefully make empty titles up to the number of columns, the check should be run on the number of subplots

Installed Versions

INSTALLED VERSIONS ------------------ commit : 0691c5c python : 3.11.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22631 machine : AMD64 processor : AMD64 Family 25 Model 33 Stepping 2, AuthenticAMD byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : English_United States.1252

pandas : 2.2.3
numpy : 1.24.2
pytz : 2025.1
dateutil : 2.8.2
pip : 25.0
Cython : None
sphinx : None
IPython : 8.12.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.3
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.2
lxml.etree : 5.3.0
matplotlib : 3.10.0
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : None
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 2.0.9
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.1
qtpy : None
pyqt5 : None

@eicchen02
Copy link
Author

I can take this and #61018 if other people can confirm the issue

@eicchen02
Copy link
Author

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

1 participant