plotly / plotly/plotly.py

[BUG]: deserialization of xrange of box select in figure with multiple subplots broken

Offen
#5,703 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P2 size: 1
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

Description

When you do a box (or lasso) select in a figure with multiple subplots (not the first subplot) the selection x/yrange is not a list/dict but a plain python object.

Image

The gif above was created with this example:

import plotly.graph_objects as go
import solara
from plotly.subplots import make_subplots

def build_figure() -> go.Figure:
	fig = make_subplots(rows=1, cols=2, subplot_titles=("Scatter", "Bar"))
	fig.add_trace(go.Scatter(x=[1, 2, 3, 4, 5, 6], y=[2, 1, 3, 5, 4, 6], name="Series A"), row=1, col=1)
	fig.add_trace(go.Bar(x=["A", "B", "C"], y=[3, 1, 2], name="Series B"), row=1, col=2)
	fig.update_layout(title="FigureWidget example with 2 subplots",)
	return fig

@solara.component
def Page():
	def on_selection(data):
		print("on_select data:", data, flush=True)
	solara.FigurePlotly(build_figure(), on_selection=on_selection)


Steps to reproduce
  1. Create a figure with more than one subplot.
  2. Do a box select in the second subplot.
  3. Observe the data send to on_select.

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

Beginne damit, das bereitgestellte Python-Beispiel mit plotly.subplots und solara.FigurePlotly auszuführen, und untersuche anschließend die Daten des on_selection-Callbacks für eine Box-Auswahl im zweiten Subplot. Verfolge, wie der selection x/yrange für nicht erste Subplots deserialisiert wird. Als abgeschlossen gilt die Aufgabe, wenn diese Bereiche als list oder dictionary statt als einfaches Python object ankommen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

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