plotly / plotly/plotly.py

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

Abierto
#5,703 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug P2 size: 1
Lenguaje dominante
Python
Estrellas
18.8k
Forks
2.8k
Merge medio
16 h 26 min
PR fusionados (30 d)
21

Descripción

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.

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

Comienza ejecutando el ejemplo de Python proporcionado con plotly.subplots y solara.FigurePlotly; después, inspecciona los datos del callback on_selection para una selección de tipo box en el segundo subplot. Rastrea cómo se deserializa selection x/yrange para los subplots que no son el primero. Se considera terminado cuando esos rangos llegan como una list o dictionary en lugar de como un objeto Python simple.

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

Evaluación

Stack tecnológico
python
Área
data-visualization
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
68/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.