figure_factory create_hexbin_mapbox ignored agg_func
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 18.8k
- Forks
- 2.8k
- Merge moyen
- 16 h 26 min
- PR mergées (30 j)
- 21
Description
As the title states, the aggregation function is entirely ignored and it does not make any difference whether you insert np.mean, np.min or np.max. Using plotly==5.22.0
Example:
- Generate data
import plotly.figure_factory as ff
import pandas as pd
import numpy as np
# Mock GeoDataFrame with latitude, longitude, and value columns
np.random.seed(0)
num_points = 1000
data = {
'lat': np.random.uniform(40, 45, num_points),
'lon': np.random.uniform(-75, -70, num_points),
'value': np.random.uniform(0, 1, num_points)
}
df = pd.DataFrame(data)
df
- Plot and check vals
fig = ff.create_hexbin_mapbox(
data_frame=df, lat="lat", lon="lon",
nx_hexagon=50, # Decrease the size of hexagons
opacity=0.5, labels={"color": "value"},
color_continuous_scale="Viridis",
agg_func=np.min, # or np.max aggregation
show_original_data=True,
original_data_marker=dict(size=1.1, opacity=0.6, color="deeppink")
)
# Extract the hexbin data
hexbin_data = fig.data[0]
# Check the hexbin values
print("Hexbin values (z):", hexbin_data.z)
# Update the text of each hexagon to display the maximum value
hexbin_data.hovertemplate = 'Value: %{z}<extra></extra>'
# Update the layout to use OSM tiles
fig.update_layout(
mapbox_style="open-street-map",
height=800 # Set the desired height
)
fig.show()
Output for np.min, np.mean and np.max is identical:
Hexbin values (z): [0. 0. 0. ... 0. 1. 0.]
Hence, the plot does not change.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez au point d’entrée de figure_factory, ff.create_hexbin_mapbox, et reproduisez le problème avec le DataFrame fourni et les exemples np.min, np.mean et np.max. Suivez la manière dont agg_func est transmis à la génération de hexbin, puis vérifiez que les valeurs résultantes de hexbin_data.z diffèrent comme il convient pour chaque fonction d’agrégation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- numpy, pandas, plotly, python
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 38/100