Choropleth: can't add/remove from current selection after zoom
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 18.3k
- Forks
- 2k
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 28
Descripción
I don't know if this is a bug or a missing feature, but i'd like to select polygons on a choropleth, zoom, then add/ remove from the current selection via shift+click.
This is especially useful when i want to remove a few central polygons from a big selection small polygons and need to select then zoom in to better see which few to remove.
This is already possible in (non-geographic) scatter plots: click to select, zoom, then shift-click to remove from selection, e.g.
import plotly.express as px
df = px.data.iris()
fig = px.scatter(df.iloc[:20], x="sepal_width", y="sepal_length")
fig.update_layout(clickmode="event+select")
fig.show()
And it's already possible in choropleths without zooming between selecting and shift-clicking.
Here's a code snippet to reproduce the bug (or missing feature).
import plotly.graph_objects as go
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv')
fig = go.Figure(data=go.Choropleth(
locations=df['code'], # Spatial coordinates
z = df['total exports'].astype(float), # Data to be color-coded
locationmode = 'USA-states', # set of locations match entries in `locations`
colorscale = 'Reds',
colorbar_title = "Millions USD",
))
fig.update_layout(
title_text = '2011 US Agriculture Exports by State',
geo_scope='usa', # limite map scope to USA
clickmode="event+select",
)
fig.show()
Now box-select some polygons, then remove a polygon from the selection by shift-clicking it.
Works nicely.
Box-select some polygons again, zoom in, then try to remove a polygon from the selection by shift-clicking it.
No can do!
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
Comienza con las reproducciones proporcionadas de scatter de Plotly Express y Choropleth de plotly.graph_objects; después, sigue en el repositorio los puntos de entrada de las interacciones de selección y zoom geográfico de los choropleth. Confirma el comportamiento existente de shift-click sin zoom y haz que el caso con zoom conserve y actualice la selección actual; se considera terminado cuando la reproducción proporcionada puede eliminar un polígono después de hacer zoom, con cobertura para esa secuencia.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Á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
- 38/100