Skip to content

Fix unused parameters being passed to pie chart #260

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 5 commits into from
Jun 14, 2025

Conversation

cvanelteren
Copy link
Contributor

Addresses #259

Will need to check this later today or tomorrow as I don't have time to check this now.

@cvanelteren cvanelteren marked this pull request as draft June 14, 2025 08:54
@cvanelteren
Copy link
Contributor Author

cvanelteren commented Jun 14, 2025

TODO: Still needs a test

@cvanelteren cvanelteren requested a review from Copilot June 14, 2025 09:13
Copilot

This comment was marked as outdated.

Copy link

codecov bot commented Jun 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@cvanelteren cvanelteren marked this pull request as ready for review June 14, 2025 20:45
@cvanelteren
Copy link
Contributor Author

Not entirely sure why for dataframes the code is forwarding the legend_kw or colorbar_kw but removing this will cause other tests to fail. What remains sure is that for pie charts these need not be forwarded; so the major contribution is to eliminate those from kwargs prior to plotting with matplotlib's pie function.

@cvanelteren cvanelteren requested a review from Copilot June 14, 2025 20:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that unused legend and colorbar parameters are not passed to pie charts (fixing #259) and adds a test to verify DataFrame index labels appear correctly on pie slices.

  • Extract legend and colorbar label values early in _parse_1d_format
  • Pop legend_kw and colorbar_kw in pie before calling the native implementation
  • Add a test case for labeled DataFrame input to pie
  • Include an example script demonstrating pie usage with DataFrames

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
ultraplot/tests/test_plot.py Add test_pie_labeled_series_in_dataframes to cover #259 edge case
ultraplot/axes/plot.py Extract and remove unused legend/colorbar kwargs in parser and pie
test.py Add demo script for pie-chart with DataFrame indices
Comments suppressed due to low confidence (3)

ultraplot/axes/plot.py:2291

  • The variable name colorbar_kw_labels is misleading since it holds the 'values' popped from colorbar_kw. Consider renaming it to colorbar_kw_values to match its purpose and the downstream parameter name.
colorbar_kw_labels = _not_none(

test.py:31

  • The call to uplt.subplot() likely should be uplt.subplots() to match the API used elsewhere (subplots returns both figure and axes). This typo can cause a runtime error.
fig, ax = uplt.subplot()

test.py:1

  • [nitpick] This demo script in the project root (test.py) could be moved to an examples/ directory to avoid confusion with actual test files and keep the repo organized.
# %%

@beckermr beckermr merged commit 7fea53f into Ultraplot:main Jun 14, 2025
15 checks passed
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.

None yet

2 participants