matplotlib / matplotlib/matplotlib

[MNT]: Unite property cycles for lines and patches

Aberta
#29,468 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Maintenance
Linguagem predominante
Python
Estrelas
23.2k
Forks
8.5k
Merge médio
1d 6h
PRs com merge (30d)
66

Descrição

### 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-unpacked `ax.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).

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece lendo a issue e a discussão relacionada em #19479 e, em seguida, localize o tratamento separado de property-cycle do Matplotlib para linhas e patches. Defina como devem funcionar um ciclo compartilhado e a reutilização explícita de um elemento do ciclo, incluindo as implicações para migração e release notes; as alternativas de API ainda não resolvidas indicam que é necessário um trabalho de design antes da implementação.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
data-visualization
Tipo de issue
Funcionalidade
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.