plotly / plotly/plotly.js

Cone tips do not point at the correct positions

未关闭
#6,714 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P2
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

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()

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

复现所提供的 Python go.Cone 示例,改变圆锥长度和相机设置,以确认位置差异。跟踪相应的 plotly.js 3D 圆锥渲染行为,并添加回归检查,以确认圆锥底部与所提供向量的起点对齐;完成的标准是圆锥指向预期的后继位置。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, python
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。