plotly / plotly/plotly.js

aspectmode=data is incorrect when cones and scatter points are both involved

Aperta
#7,143 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug sev-2
Lingua principale
JavaScript
Stelle
18.3k
Fork
2k
Merge medio
2g 12h
PR unite (30g)
28

Descrizione

See https://codepen.io/alexcjohnson/pen/ExBryzb?editors=0010

When all traces in this plot are shown, the square is not square:
Screenshot 2024-09-08 at 17 58 11

But if you click the legend to hide the cone trace, you do get a square:
Screenshot 2024-09-08 at 17 58 36

This is a pretty important bug for anyone making a plot representing real 3D space, as shapes will be distorted and the only workaround I could find is to abandon axis autorange: set explicit ranges for all three axes, set aspectmode: 'manual', and calculate aspectratio.{x, y, z} explicitly.

I haven't been able to reproduce this issue with only scatter3d traces, nor have I tried with other trace types or with just cones, but my guess is we're calculating the axis aspect ratios before adding extra padding to the ranges to accommodate the cones. Ironically it appears we don't pad the axes (not at all? not very much? I can't quite tell) for scatter3d points, but that's a separate issue.

As a side note: it would be nice if aspectratio or aspectmode docs stated that aspectratio is ignored when you set aspectmode: 'data'. I've seen users try to use this combination of attributes to create vertical exaggeration of topography, but this fails (and again, the only solution I can find is to calculate everything manually).

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla riproduzione CodePen collegata e segui il modo in cui 3D aspectmode:'data' gestisce gli intervalli degli assi quando le trace cone e scatter3d sono entrambe visibili. Confronta il risultato con cone nascosto; il lavoro è completato quando il quadrato rimane quadrato con entrambe le trace visualizzate e la documentazione di aspectratio/aspectmode spiega la limitazione segnalata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.