Incorrect fill in graph objects when connectgaps is set to false
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 18.8k
- Forks
- 2.8k
- Merge medio
- 16 h 26 min
- PR fusionados (30 d)
- 21
Descripción
Whenever a graph object has the following parameters:
First series -> fill='tonexty',
Second series -> connectgaps=False
The fill connects the first point of this series with the first point of the last segment after "gaps" from the second series, instead of its respective first value.
Here is a basic example
import plotly.graph_objects as go
fig = go.Figure()
def remove_from_list(lst, idx):
return lst[:idx] + [None] + lst[idx+1:]
x = [i for i in range(5)]
y = [1 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(y, 2),
connectgaps=False
))
y = [2 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=y,
fill='tonexty',
))
fig.show()
Here is another example with more than 1 gap in the data:
import plotly.graph_objects as go
fig = go.Figure()
def remove_from_list(lst, idx):
return lst[:idx] + [None] + lst[idx+1:]
x = [i for i in range(8)]
y = [1 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(remove_from_list(y, 2), 5),
connectgaps=False
))
y = [2 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=y,
fill='tonexty',
))
fig.show()
I've also attached their respective figure outuputs.
Finally, I have an additional comment regarding how areas are filled.
The following shows another basic example with gaps in both series, and both with connectgaps=False.
import plotly.graph_objects as go
fig = go.Figure()
def remove_from_list(lst, idx):
return lst[:idx] + [None] + lst[idx+1:]
x = [i for i in range(5)]
y = [1 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(y, 2),
connectgaps=False
))
y = [2 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(y, 2),
fill='tonexty',
connectgaps=False
))
fig.show()
The connected area spans even the places where the values are undefined (during a gap). My expectation would be the opposite:
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
No se nombran archivos fuente ni pruebas. Empieza ejecutando los ejemplos de Python proporcionados con plotly.graph_objects y compara los rellenos renderizados alrededor de los valores None cuando connectgaps=False. Se considera terminado cuando los rellenos usan los segmentos correspondientes de la serie y no abarcan huecos indefinidos; añade cobertura de regresión para los casos mostrados.
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
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100