Title: Scattergl Hover:closest and Click only active with first-plotted trace · Issue #2079 · plotly/plotly.py · GitHub
Open Graph Title: Scattergl Hover:closest and Click only active with first-plotted trace · Issue #2079 · plotly/plotly.py
X Title: Scattergl Hover:closest and Click only active with first-plotted trace · Issue #2079 · plotly/plotly.py
Description: EDIT Problem: Scattergl hover and click functionalities are only available for the first-plotted trace if one has multiple traces but does not matter when using Scatter. /EDIT I am using plotly 4.4.1 and was trying out the network demo o...
Open Graph Description: EDIT Problem: Scattergl hover and click functionalities are only available for the first-plotted trace if one has multiple traces but does not matter when using Scatter. /EDIT I am using plotly 4.4...
X Description: EDIT Problem: Scattergl hover and click functionalities are only available for the first-plotted trace if one has multiple traces but does not matter when using Scatter. /EDIT I am using plotly 4.4...
Opengraph URL: https://github.com/plotly/plotly.py/issues/2079
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Scattergl Hover:closest and Click only active with first-plotted trace","articleBody":"**EDIT** \r\nProblem: \r\n`Scattergl` hover and click functionalities are only available for the first-plotted trace if one has multiple traces but does not matter when using `Scatter`. \r\n**/EDIT**\r\n\r\nI am using plotly 4.4.1 and was trying out the [network demo](https://plot.ly/python/network-graphs/) on the plotly website. Since I have lots of nodes and edges in my graph, I tried using `Scattergl` instead.\r\n\r\nThis works and speeds up the plotting but disables the tool tips on hover on `hovermode=\"closest\"`. The hover does however still find the points, which we can see when we press \"Toggle Spike Lines\", which snap onto the point our cursor is closest to. \r\n\r\nClicking on the \"compare data on hover\" button let's tool tips appear but this is a very erratic experience when we have a lot of points close to each other.\r\n\r\n**EDIT: I have produced a smaller code example in the next comment on this thread.**\r\n\r\nNot sure if this was addressed in https://github.com/plotly/plotly.js/pull/4323 which should be part of my version (4.4.1).\r\nBelow is the [network demo](https://plot.ly/python/network-graphs/) with `Scatter` substituted for `Scattergl`, which can reproduce my issue:\r\n```\r\nimport plotly.graph_objects as go\r\n\r\nimport networkx as nx\r\n\r\nG = nx.random_geometric_graph(200, 0.125)\r\nedge_x = []\r\nedge_y = []\r\nfor edge in G.edges():\r\n x0, y0 = G.nodes[edge[0]]['pos']\r\n x1, y1 = G.nodes[edge[1]]['pos']\r\n edge_x.append(x0)\r\n edge_x.append(x1)\r\n edge_x.append(None)\r\n edge_y.append(y0)\r\n edge_y.append(y1)\r\n edge_y.append(None)\r\n\r\nedge_trace = go.Scattergl(\r\n x=edge_x, y=edge_y,\r\n line=dict(width=0.5, color='#888'),\r\n hoverinfo='none',\r\n mode='lines')\r\n\r\nnode_x = []\r\nnode_y = []\r\nfor node in G.nodes():\r\n x, y = G.nodes[node]['pos']\r\n node_x.append(x)\r\n node_y.append(y)\r\n\r\nnode_trace = go.Scattergl(\r\n x=node_x, y=node_y,\r\n mode='markers',\r\n hoverinfo='text',\r\n marker=dict(\r\n showscale=True,\r\n # colorscale options\r\n #'Greys' | 'YlGnBu' | 'Greens' | 'YlOrRd' | 'Bluered' | 'RdBu' |\r\n #'Reds' | 'Blues' | 'Picnic' | 'Rainbow' | 'Portland' | 'Jet' |\r\n #'Hot' | 'Blackbody' | 'Earth' | 'Electric' | 'Viridis' |\r\n colorscale='YlGnBu',\r\n reversescale=True,\r\n color=[],\r\n size=10,\r\n colorbar=dict(\r\n thickness=15,\r\n title='Node Connections',\r\n xanchor='left',\r\n titleside='right'\r\n ),\r\n line_width=2))\r\nnode_adjacencies = []\r\nnode_text = []\r\nfor node, adjacencies in enumerate(G.adjacency()):\r\n node_adjacencies.append(len(adjacencies[1]))\r\n node_text.append('# of connections: '+str(len(adjacencies[1])))\r\n\r\nnode_trace.marker.color = node_adjacencies\r\nnode_trace.text = node_text\r\nfig = go.Figure(data=[edge_trace, node_trace],\r\n layout=go.Layout(\r\n title='\u003cbr>Network graph made with Python',\r\n titlefont_size=16,\r\n showlegend=False,\r\n hovermode='closest',\r\n margin=dict(b=20,l=5,r=5,t=40),\r\n annotations=[ dict(\r\n text=\"Python code: \u003ca href='https://plot.ly/ipython-notebooks/network-graphs/'> https://plot.ly/ipython-notebooks/network-graphs/\u003c/a>\",\r\n showarrow=False,\r\n xref=\"paper\", yref=\"paper\",\r\n x=0.005, y=-0.002 ) ],\r\n xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),\r\n yaxis=dict(showgrid=False, zeroline=False, showticklabels=False))\r\n )\r\nfig.show()\r\n```\r\n","author":{"url":"https://github.com/tobsecret","@type":"Person","name":"tobsecret"},"datePublished":"2020-01-15T21:35:11Z","url":"https://github.com/plotly/plotly.py/issues/2079"}
| 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:eebb6b99-9e78-e886-f858-26f76e29832f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B5B2:299992:A83972:DEB69A:6B01BB51 |
| html-safe-nonce | 83b166a1870272d7e4c88188cfc3f50c169f82653ba9f6990efaa99fd444af1b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUIyOjI5OTk5MjpBODM5NzI6REVCNjlBOjZCMDFCQjUxIiwidmlzaXRvcl9pZCI6IjUwODY3MDgwNzYwMTUzNjkwNDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 54bf305e89b36b9389426595c5012682b75cce48bbf43b9b481952274eab9c3c |
| hovercard-subject-tag | issue:550442547 |
| 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/2079/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a319dcd4bcb7f0eb19b6545dc4384b3a93e37a1789a3ee2e69f9a1a9ad87a584/plotly/plotly.py/issues/2079 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a319dcd4bcb7f0eb19b6545dc4384b3a93e37a1789a3ee2e69f9a1a9ad87a584/plotly/plotly.py/issues/2079 |
| og:image:alt | EDIT Problem: Scattergl hover and click functionalities are only available for the first-plotted trace if one has multiple traces but does not matter when using Scatter. /EDIT I am using plotly 4.4... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tobsecret |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width