Title: figure_factory create_hexbin_mapbox ignored agg_func · Issue #4632 · plotly/plotly.py · GitHub
Open Graph Title: figure_factory create_hexbin_mapbox ignored agg_func · Issue #4632 · plotly/plotly.py
X Title: figure_factory create_hexbin_mapbox ignored agg_func · Issue #4632 · plotly/plotly.py
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 pan...
Open Graph 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 impor...
X 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 impor...
Opengraph URL: https://github.com/plotly/plotly.py/issues/4632
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"figure_factory create_hexbin_mapbox ignored agg_func","articleBody":"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`\r\n\r\nExample: \r\n\r\n1. Generate data \r\n\r\n```python\r\nimport plotly.figure_factory as ff\r\nimport pandas as pd\r\nimport numpy as np\r\n\r\n# Mock GeoDataFrame with latitude, longitude, and value columns\r\nnp.random.seed(0)\r\nnum_points = 1000\r\ndata = {\r\n 'lat': np.random.uniform(40, 45, num_points),\r\n 'lon': np.random.uniform(-75, -70, num_points),\r\n 'value': np.random.uniform(0, 1, num_points)\r\n}\r\ndf = pd.DataFrame(data)\r\ndf\r\n```\r\n\r\n2. Plot and check vals\r\n\r\n```python \r\n\r\nfig = ff.create_hexbin_mapbox(\r\n data_frame=df, lat=\"lat\", lon=\"lon\",\r\n nx_hexagon=50, # Decrease the size of hexagons\r\n opacity=0.5, labels={\"color\": \"value\"},\r\n color_continuous_scale=\"Viridis\",\r\n agg_func=np.min, # or np.max aggregation\r\n show_original_data=True,\r\n original_data_marker=dict(size=1.1, opacity=0.6, color=\"deeppink\")\r\n)\r\n\r\n# Extract the hexbin data\r\nhexbin_data = fig.data[0]\r\n\r\n# Check the hexbin values\r\nprint(\"Hexbin values (z):\", hexbin_data.z)\r\n\r\n# Update the text of each hexagon to display the maximum value\r\nhexbin_data.hovertemplate = 'Value: %{z}\u003cextra>\u003c/extra>'\r\n\r\n# Update the layout to use OSM tiles\r\nfig.update_layout(\r\n mapbox_style=\"open-street-map\",\r\n height=800 # Set the desired height\r\n)\r\n\r\nfig.show()\r\n\r\n```\r\n\r\nOutput for np.min, np.mean and np.max is identical:\r\n\r\n`Hexbin values (z): [0. 0. 0. ... 0. 1. 0.]`\r\n\r\nHence, the plot does not change. \r\n","author":{"url":"https://github.com/do-me","@type":"Person","name":"do-me"},"datePublished":"2024-06-11T14:06:13Z","url":"https://github.com/plotly/plotly.py/issues/4632"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:20c11865-176a-d5c4-6dc2-19999a4b6bd1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9182:D5AA4:1194C63:1777172:6B0111D0 |
| html-safe-nonce | ade4dabdd0554612465092d095345e96fa38daddd1ab4ce82766b4945e7cca9c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTgyOkQ1QUE0OjExOTRDNjM6MTc3NzE3Mjo2QjAxMTFEMCIsInZpc2l0b3JfaWQiOiI1OTkxNzIyOTQzMDE1NjIxMDcyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fb9a03ca8614a47b73c5e231f045ad5b3958d0d55929e11164511b76fa2c16b2 |
| hovercard-subject-tag | issue:2346533928 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.py/4632/issue_layout |
| twitter:image | https://opengraph.githubassets.com/751593ea8c1892549a65c997f6e4ae072836f7cb80bc74457f68cce711cad759/plotly/plotly.py/issues/4632 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/751593ea8c1892549a65c997f6e4ae072836f7cb80bc74457f68cce711cad759/plotly/plotly.py/issues/4632 |
| og:image:alt | 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 impor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | do-me |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 14579099 |
| octolytics-dimension-repository_nwo | plotly/plotly.py |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14579099 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.py |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width