plotly / plotly/plotly.js

Cone tips do not point at the correct positions

Offen
#6,714 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P2
Vorherrschende Sprache
JavaScript
Sterne
18.3k
Forks
2k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
28

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere das bereitgestellte Python go.Cone-Beispiel, variiere die Kegellänge und die Kameraeinstellungen, um die Positionsabweichung zu bestätigen. Verfolge das entsprechende 3D-Kegel-Rendering-Verhalten von plotly.js und füge eine Regression-Prüfung hinzu, die sicherstellt, dass die Kegelbasen an den bereitgestellten Vektorstartpunkten ausgerichtet sind; abgeschlossen bedeutet, dass die Kegel auf die erwarteten Nachfolgerpositionen zeigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.