figure_factory create_hexbin_mapbox ignored agg_func
オープン
まだ誰も着手していません。
bug
P3
sev-4
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
figure_factory のエントリポイント ff.create_hexbin_mapbox から始め、提供された DataFrame と np.min、np.mean、np.max の例を使って問題を再現します。agg_func が hexbin の生成にどのように渡されるかを追跡し、その後、結果の hexbin_data.z の値が各集約関数に応じて適切に異なることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- numpy, pandas, plotly, python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 38/100