plotly / plotly/plotly.js

Cone tips do not point at the correct positions

Abierto
#6,714 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug P2
Lenguaje dominante
JavaScript
Estrellas
18.3k
Forks
2k
Merge medio
2 d 12 h
PR fusionados (30 d)
28

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el ejemplo proporcionado de Python go.Cone, variando la longitud del cono y la configuración de la cámara para confirmar la discrepancia posicional. Rastrea el comportamiento correspondiente del renderizado de conos 3D de plotly.js y añade una comprobación de regresión para que las bases de los conos se alineen con los puntos iniciales de los vectores proporcionados; terminado significa que los conos apuntan a las posiciones sucesoras esperadas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, python
Área
data-visualization
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.