Open
Description
Summary
Loosely insprired by #19479.
We have separate property cycles for lines and patches. This is a source of confusion and IMHO doesn't give a benefit.
Proposed fix
Unite the property cycles so that an Axes has just one cycle to draw from, no matter what the Artist is.
- Most simple plots use only either lines or patches. They wouldn't know the difference.
- If plots have both lines and patches, e.g. one line, one bar plot, IMHO it's more clear to by default use different colors.
- It's quite unlikely that people implicitly rely on synced colors to intentionally have parallelism between the lines and colors.
Migration:
- Add/document a way to get the state of the next element in the cycle (as long as there are two, use the line cycle). This will enable explicit use of a cycle element for multiple artists like this:
prop = ax.prop_cycle_next() ax.plot(..., color=prop['color']) ax.bar(... color=prop['color'])
- Maybe consider ways to feed a cycle element back into a plotting function, either through an explicit kwarg
ax.plot(..., prop=prop)
, or by ensuring that the cycle element can be dict-unpackedax.plot(..., **prop)
. - Minimal announce this as upcoming change in the release notes. If people are relying on parallel cycles they should move to the above pattern.
- We could also detect when both cyclers are used and issue a warning. The downside is that people will get a warning as soon as they use a mixture of lines and patches and they may be ok with the new behavior (it's unlikely they really intend to use the old behavior).