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

Appearance settings

Subplot title count fix + fix for issue introduced in earlier PR #61393

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

Merged
merged 34 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8440dde
test case for subplot stacking
eicchen Mar 21, 2025
350a7ec
Removed overlooked print statement
eicchen Mar 21, 2025
b27d1ac
Updated test to check other subplot in figure
eicchen Mar 30, 2025
46c6eaa
Merge commit '5736b9647068d31fdf8673d3528cb64e35060bac' into bar_plot…
eicchen Apr 6, 2025
1fe342a
Updated test cases to include more subplot stacking possibilities
eicchen Apr 8, 2025
de55789
removed savefig() left in test cases
eicchen Apr 8, 2025
e8a6f91
Updated test cases to test more arrangements
eicchen Apr 22, 2025
0d9f5da
Completed function fix (order of subplot input does not matter, need …
eicchen Apr 22, 2025
b356028
appeasing the great pre-commit formatter
eicchen Apr 23, 2025
6cd8a51
Merge branch 'main' into bar_plot_stacking_fix
eicchen Apr 23, 2025
4cc2905
Updated whatsnew
eicchen Apr 23, 2025
9974632
Docstring adjustment
eicchen Apr 23, 2025
ddd3311
Moved self.subplot check to a seperate bool
eicchen Apr 23, 2025
df51168
Added ignore where mypy thinks self.subplots is a bool
eicchen Apr 23, 2025
bfb1dd1
Actually addressed mypy typing
eicchen Apr 23, 2025
e4d5040
Incorperated initial PR comments
eicchen Apr 25, 2025
101ee62
Updated missing () after .all
eicchen Apr 25, 2025
cfa3ada
Initial test cases
eicchen Apr 25, 2025
2a8f126
Addressed more comments on PR
eicchen Apr 25, 2025
9630ee5
Updated '&' to 'and'
eicchen Apr 28, 2025
ab4f7a6
Updated Test cases
eicchen Apr 28, 2025
abe5c3f
Fixed crash when "subplots=True" is used
eicchen Apr 29, 2025
2e8fc9a
Title check checks for subplot length if specified
eicchen May 2, 2025
9dd73d1
Updated Test cases
eicchen Apr 28, 2025
7e50fa0
Title check checks for subplot length if specified
eicchen May 2, 2025
0273814
Merge branch 'subplot_label_count_fix' of https://github.com/eicchen0…
eicchen May 2, 2025
d501e49
Updated test name
eicchen May 2, 2025
584a4a9
Removed extra '_' in test name
eicchen May 2, 2025
16b6792
Fixed issue where expected_total_height returns as a df instead of a …
eicchen May 2, 2025
67f3b41
Merge branch 'bar_plot_stacking_fix' into subplot_label_count_fix
eicchen May 2, 2025
11c7a88
Updated change notes
eicchen May 2, 2025
c895916
Addressed mypy error
eicchen May 2, 2025
878e610
Addresed PR comments
eicchen May 6, 2025
b93eedb
Changed exception message raised and updated test case
eicchen May 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Title check checks for subplot length if specified
  • Loading branch information
eicchen committed May 2, 2025
commit 2e8fc9ac2d17783b63a9a39ca8d3ee9453e330f1
11 changes: 10 additions & 1 deletion 11 pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,16 @@ def _adorn_subplots(self, fig: Figure) -> None:
if self.title:
if self.subplots:
if is_list_like(self.title):
if len(self.title) != self.nseries:
if type(self.subplots) != bool:
eicchen marked this conversation as resolved.
Show resolved Hide resolved
if len(self.subplots) != len(self.title):
raise ValueError(
"The length of `title` must equal the number "
"of subplots if `title` of type `list` "
"and subplots is iterable.\n"
eicchen marked this conversation as resolved.
Show resolved Hide resolved
f"length of title = {len(self.title)}\n"
f"number of subplots = {len(self.subplots)}"
eicchen marked this conversation as resolved.
Show resolved Hide resolved
)
elif len(self.title) != self.nseries:
raise ValueError(
"The length of `title` must equal the number "
"of columns if using `title` of type `list` "
Expand Down
5 changes: 3 additions & 2 deletions 5 pandas/tests/plotting/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,9 @@ def test_plot_bar_label_count_expected_fail():
)
with pytest.raises(
ValueError,
match="The length of `title` must equal the number of columns "
"if using `title` of type `list` and `subplots=True`.",
match="The length of `title` must equal the number "
"of subplots if `title` of type `list` "
"and subplots is iterable.\n",
):
df.plot(
subplots=[("A", "B")],
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.