Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MNT: Separate property cycle handling from _process_plot_var_args#29469

Merged
ksunden merged 1 commit intomatplotlib:mainfrom
timhoffm:extract-prop-cycle
Mar 6, 2026
Merged

MNT: Separate property cycle handling from _process_plot_var_args#29469
ksunden merged 1 commit intomatplotlib:mainfrom
timhoffm:extract-prop-cycle

Conversation

@timhoffm
Copy link
Copy Markdown
Member

By encapsulating the cycling into a dedicated class, we prepare for making cycling sharable between multiple _process_plot_var_args instances, which is the prerequisite for unifying the separate cyclers for lines and patches (#29468) and sharing cyclers between multiple Axes (#19479).

By encapsulating the cycling into a dedicated class, we prepare for
making cycling sharable between multiple _process_plot_var_args instances,
which is the prerequisite for unifying the separate cyclers for lines and
patches (matplotlib#29468) and sharing cyclers between multiple Axes (matplotlib#19479).
return self._prop_cycle.get_next_color()

def _setdefaults(self, defaults, kw):
@staticmethod
Copy link
Copy Markdown
Member Author

@timhoffm timhoffm Jan 13, 2025

Choose a reason for hiding this comment

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

This is not strictly related, but noticed that _setdefaults does not depend on the class, so making that explicit via staticmethod as an improvement on the side.

@cvanelteren
Copy link
Copy Markdown
Contributor

Hi, just wanted to chip in that we are facing similar issues that it is a bit opague how the cycling is handled. In our case we would also need a get_next_item next to the color; could this be added to this PR? It would make the cycling handling more robust without resorting to the manual cycling we are currently doing in UltraPlot.

@timhoffm
Copy link
Copy Markdown
Member Author

Thanks for the feedback. This PR is an internal refactoring and since we currently don’t need that function. I won’t add it to the PR. After all, this is all internal for now and we reserve the right to change everything. Even if I would add the function you could not rely that it will be available and have a defined API.

That said, this is part of a larger plan to make cycling more flexible. I plan to make the cycle in the Axes accessible as public API, which also includes the ability to get the next element.

@cvanelteren
Copy link
Copy Markdown
Contributor

Ok thanks for clarifying. Then I will proceed with our internal cycling for now.

@tacaswell tacaswell added this to the v3.11.0 milestone Mar 5, 2026
@ksunden ksunden merged commit bfa363a into matplotlib:main Mar 6, 2026
10 checks passed
@timhoffm timhoffm deleted the extract-prop-cycle branch March 6, 2026 20:20
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Mar 16, 2026
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants