get_legend_handles_labels() for errorbar plot not working properly
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu bằng cách chạy các ví dụ Julia trong issue và kiểm tra entry point get_legend_handles_labels() cùng quá trình chuyển đổi sang PyObject của nó. So sánh các errorbar handle được trả về với các đối tượng ErrorbarContainer của Python, sau đó xác minh rằng việc đảo ngược các handle vẫn giữ lại các thanh sai số trong chú giải.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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>,))
- Ngôn ngữ chính
- Julia
- Star
- 489
- Fork
- 90
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của JuliaPy/PyPlot.jl
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
julia PyPlot support missing dataCó thể đã có người làm @deszoeke đã nhận 668 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
colors has no field TwoSlopeNormĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
-
PGF preamble is not usedĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Problem in using PyPlot in JuliaĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Tất cả issue của JuliaPy/PyPlot.jl
Issue tương tự
-
Broken links in the docsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
oxfordcontrol/COSMO.jl#211 ·
-
documentation
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 6 ngày
-
Out-of-place JLArray/GPU problem with VectorContinuousCallback scalar-indexes (callback cache built with CPU zeros)Có thể đã có người làm @ChrisRackauckas-Claude đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
SciML/OrdinaryDiffEq.jl#4813 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ARKODE: callbacks that modify `u` throw MethodError on reinitCó thể đã có người làm @devmotion đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
SciML/Sundials.jl#575 ·