get_legend_handles_labels() for errorbar plot not working properly
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- python
- Domínio
- data-visualization
Direção de pesquisa
Comece executando os exemplos de Julia na issue e inspecione o ponto de entrada get_legend_handles_labels() e sua conversão para PyObject. Compare os handles de errorbar retornados com os objetos ErrorbarContainer do Python e, em seguida, verifique se inverter os handles preserva as barras de erro na legenda.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Related to https://github.com/JuliaPy/PyPlot.jl/issues/401.
I'm simply trying to reverse the order of the legend entries of two errorbar plots.
Pure python (from within Julia):
py"""
import matplotlib.pyplot as plt
import numpy as np
plt.errorbar(np.random.rand(10), np.random.rand(10), np.random.rand(10), label='first', marker='o', linestyle="")
plt.errorbar(np.random.rand(10), np.random.rand(10), np.random.rand(10), label='second', marker='o', linestyle="")
h,l = plt.gca().get_legend_handles_labels()
plt.legend(reversed(h),reversed(l), frameon=True)
"""

Using PyPlot:
errorbar(rand(10), rand(10), rand(10), label="first", marker="o", linestyle="")
errorbar(rand(10), rand(10), rand(10), label="second", marker="o", linestyle="")
h,l = gca().get_legend_handles_labels()
legend(reverse(h),reverse(l), frameon=true)

Note that the handles are wrong (should be markers with error bars).
PyPlot + ugly fix:
errorbar(rand(10), rand(10), 0.1 .* rand(10), marker="o", linestyle="none", label="first")
errorbar(rand(10), rand(10), 0.1 .* rand(10), marker="o", linestyle="none", label="second")
py"""
import matplotlib.pyplot as plt
h, l = plt.gca().get_legend_handles_labels()
plt.legend(reversed(h), reversed(l), frameon=True)
"""

Presumably a PyObject conversion issue? In python, h is a container
[<ErrorbarContainer object of 3 artists>,
<ErrorbarContainer object of 3 artists>]
In Julia I find
2-element Array{Tuple{PyObject,Tuple{PyObject,PyObject},Tuple{PyObject}},1}:
(PyObject <matplotlib.lines.Line2D object at 0x000000006FAB9F98>, (PyObject <matplotlib.lines.Line2D object at 0x000000006FAD6780>, PyObject <matplotlib.lines.Line2D object at 0x000000006FAD6EF0>), (PyObject <matplotlib.collections.LineCollection object at 0x000000006FAD6320>,))
(PyObject <matplotlib.lines.Line2D object at 0x000000006FADF860>, (PyObject <matplotlib.lines.Line2D object at 0x000000006FADFB70>, PyObject <matplotlib.lines.Line2D object at 0x000000006FADFCC0>), (PyObject <matplotlib.collections.LineCollection object at 0x000000006FADF550>,))
- Linguagem predominante
- Julia
- Estrelas
- 489
- Forks
- 90
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de JuliaPy/PyPlot.jl
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
-
julia PyPlot support missing dataTalvez já em andamento @deszoeke assumiu há 668 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 30/100
-
PGF preamble is not usedAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
Todas as issues de JuliaPy/PyPlot.jl
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
SciML/DiffEqNoiseProcess.jl#342 ·
-
Broken links in the docsAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
oxfordcontrol/COSMO.jl#211 ·
-
documentation
Dificuldade 2/5 Meio dia Facilidade para iniciantes 65/100
Mantenedores costumam responder em até 6 dias