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 fix: Replace prop_cycler with Cycler() #3349

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

kratman
Copy link
Contributor

@kratman kratman commented Sep 16, 2023

Description

Matplotlib updated to 3.8 on Friday. Since then the line

color = next(ax._get_lines.prop_cycler)["color"]

causes the following error:

AttributeError: '_process_plot_var_args' object has no attribute 'prop_cycler'

I have replaced the prop_cycler with a cycler object and configured it with a generic color order. This was the most minimal change I could think of to resolve the issue. I am open to suggestions for a specific color set or I can just remove the explicit cycler and let matplotlib handle the colors itself. The latter also resolves the issue.

Fixes #3346

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ pre-commit run (or $ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s quick).

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes in the notebook are the same in this file. The notebook and script share a lot of the same code.

@kratman kratman changed the title Replace prop_cycler with Cycler() Bug fix: Replace prop_cycler with Cycler() Sep 16, 2023
@codecov
Copy link

codecov bot commented Sep 18, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (6622ec6) 99.55% compared to head (3c13617) 99.55%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3349   +/-   ##
========================================
  Coverage    99.55%   99.55%           
========================================
  Files          253      253           
  Lines        19553    19553           
========================================
  Hits         19466    19466           
  Misses          87       87           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@brosaplanella
Copy link
Member

@all-contributors please add @kratman for bug fixes

@allcontributors
Copy link
Contributor

@brosaplanella

I've put up a pull request to add @kratman! 🎉

@brosaplanella brosaplanella merged commit 5687ab0 into pybamm-team:develop Sep 18, 2023
31 of 32 checks passed
@kratman kratman deleted the bug/fixColorError branch September 18, 2023 14:34
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.

[Bug]: failing example notebook and script for COMSOL discharge curves
2 participants