You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
importplotly.figure_factoryasffimportpandasaspdimportnumpyasnp# Mock GeoDataFrame with latitude, longitude, and value columnsnp.random.seed(0)
num_points=1000data= {
'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 hexagonsopacity=0.5, labels={"color": "value"},
color_continuous_scale="Viridis",
agg_func=np.min, # or np.max aggregationshow_original_data=True,
original_data_marker=dict(size=1.1, opacity=0.6, color="deeppink")
)
# Extract the hexbin datahexbin_data=fig.data[0]
# Check the hexbin valuesprint("Hexbin values (z):", hexbin_data.z)
# Update the text of each hexagon to display the maximum valuehexbin_data.hovertemplate='Value: %{z}<extra></extra>'# Update the layout to use OSM tilesfig.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.
The text was updated successfully, but these errors were encountered:
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:
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.
The text was updated successfully, but these errors were encountered: