plotly / plotly/plotly.js

Cone tips do not point at the correct positions

Đang mở
#6,714 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug P2
Ngôn ngữ chính
JavaScript
Star
18.3k
Fork
2k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
28

Mô tả

In the following, each of two vectors ends at the start of the next one. Tweaking the length of the cones in any way suited to examining them visually, they clearly do not point at the base of their successor cone as (naively?) expected. At least if we expect that the bases of the cones are centered to the start point of the vector it is representing.

import plotly.graph_objs as go
from numpy import array

points = [
    [array([-0.03620968,  0.24876811,  5.51279187]), array([1.39049627, 0.57429448, 4.67921793])],
    [array([1.39049627, 0.57429448, 4.67921793]), array([2.02424265, -0.15235655,  2.63707954])],
    [array([ 2.02424265, -0.15235655,  2.63707954]), array([ 3.68335955, -1.14431782,  1.09909298])]
]

cone_traces = []

for pair in points:
        start_point = pair[0]
        end_point = pair[1]
        vector = end_point - start_point

        # a partial workaround to scale the vectors more or less to their actual length, which
        # plottly does not allow fully controlling: https://github.com/plotly/plotly.js/issues/3613
        scaled_vector = vector * 1.5

        start_x, start_y, start_z = start_point[0], start_point[1], start_point[2]
        end_x, end_y, end_z = end_point[0], end_point[1], end_point[2]

        trace = go.Cone(
            x=[start_x],
            y=[start_y],
            z=[start_z],
            u=[scaled_vector[0]],
            v=[scaled_vector[1]],
            w=[scaled_vector[2]])
        cone_traces.append(trace)

layout = go.Layout(

    scene=dict(
        camera=dict(

            # set the virtual point of view to point to the origin
            center=dict(x=0, y=0, z=0),

            # set the virtual point of view to be positioned parallel to the depth axis, at a distance
            # sufficently away from the vectors to see them all; although plotly won't fully respect the
            # angle this eye position should make, https://stackoverflow.com/q/76q921229/1509695,
            # it will be very very close to that, and the chart user can nudge the tilt to
            # perfect the viewing angle.
            eye=dict(x=0, y=0, z=-3))))

fig = go.Figure(data=cone_traces, layout=layout)
fig.show()

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện ví dụ Python go.Cone được cung cấp, thay đổi độ dài hình nón và các thiết lập camera để xác nhận sự sai lệch về vị trí. Theo dõi hành vi kết xuất hình nón 3D tương ứng của plotly.js và thêm một kiểm tra hồi quy để xác nhận các đáy hình nón căn chỉnh với các điểm bắt đầu của vector được cung cấp; hoàn thành có nghĩa là các hình nón hướng đến các vị trí kế tiếp mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, python
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.