René's URL Explorer Experiment


Title: The selectedpoints attribute for Histogram plots is being set incorrectly · Issue #2698 · plotly/plotly.py · GitHub

Open Graph Title: The selectedpoints attribute for Histogram plots is being set incorrectly · Issue #2698 · plotly/plotly.py

X Title: The selectedpoints attribute for Histogram plots is being set incorrectly · Issue #2698 · plotly/plotly.py

Description: I am working in a Jupyter notebook and when accessing the selectedpoints attribute of a go.Histogram or the points list in the on_selection callback, the list does not contain integer indices of the selected points but instead just a lis...

Open Graph Description: I am working in a Jupyter notebook and when accessing the selectedpoints attribute of a go.Histogram or the points list in the on_selection callback, the list does not contain integer indices of th...

X Description: I am working in a Jupyter notebook and when accessing the selectedpoints attribute of a go.Histogram or the points list in the on_selection callback, the list does not contain integer indices of th...

Opengraph URL: https://github.com/plotly/plotly.py/issues/2698

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The selectedpoints attribute for Histogram plots is being set incorrectly","articleBody":"I am working in a Jupyter notebook and when accessing the `selectedpoints` attribute of a `go.Histogram` or the points list in the `on_selection` callback, the list does not contain integer indices of the selected points but instead just a list of objects.\r\n\r\n```python\r\nimport plotly.graph_objects as go\r\nimport numpy as np\r\n\r\nnp.random.seed(1)\r\nx = np.random.randn(500)\r\n\r\ndef on_selection_print(obj, points, selector):\r\n    print(points.point_inds)\r\n\r\nfigure_widget = go.FigureWidget(data=[go.Histogram(x=x)])\r\nfigure_widget.update_layout(dragmode=\"select\")    \r\nfigure_widget.data[0].on_selection(on_selection_print)\r\nfigure_widget\r\n```\r\n\r\nWhen selecting points in the histogram, the output looks something like:\r\n`[\u003cobject object at 0x7ff062c497f0>, \u003cobject object at 0x7ff062c497f0>, \u003cobject object at 0x7ff062c497f0>, \u003cobject object at 0x7ff062c497f0>, \u003cobject object at 0x7ff062c497f0>, \u003cobject object at 0x7ff062c497f0>]`\r\n\r\nA call to `figure_widget.data[0].selectedpoints` returns the same list.\r\n\r\nThe expected output would be something like:\r\n`[0, 12, 13, 26, 31, ..., 2534]`\r\n\r\nAs you can see, all objects are identical (memory address `0x7ff062c497f0`) and the objects in the list do not have any attributes. The length of the list corresponds to the number of bars selected if that helps.\r\n\r\nI am working with plotly version `4.9.0`, ipywidgets version `7.5.1` and notebook version `6.0.1`.\r\n\r\n**UPDATE**:\r\nI checked how Plotly.js handles selection for histograms and found that it creates an object for each selected bar, which in turn contains all the points for that bar.\r\ne.g.\r\n```javascript\r\n{\r\n    points: [\r\n        0: {..., pointIndices: [1,2,3,4], ...},\r\n        1: {..., pointIndices: [5,6,7,8,9], ...},\r\n        ...\r\n    ],\r\n    range: [...]\r\n}\r\n```\r\nCodepen can be found here: https://codepen.io/meffmadd/pen/zYqGmaw\r\n\r\nSo the problem seems to be that the points are not correctly serialised for histograms. Without understanding the whole codebase I think there seem to be two options:\r\n1. Update the setter to `_js2py_pointsCallback` when the figure is a histogram in https://github.com/plotly/plotly.py/blob/efc66509526bdde772e8a8caaf1bcee865ccec3a/packages/javascript/plotlywidget/src/Figure.js#L1134\r\n2. Updating the model for the histogram on the Python side to reflect the behaviour of the JavaScript implementation. I don't know how exactly this would work yet.\r\n\r\nAny pointers in the right direction are highly appreciated!\r\n","author":{"url":"https://github.com/meffmadd","@type":"Person","name":"meffmadd"},"datePublished":"2020-08-10T10:51:17Z","url":"https://github.com/plotly/plotly.py/issues/2698"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0c0becc1-3955-a3e7-2641-cb760df739cd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAD7A:DA744:1803516:2045A84:6B0151A1
html-safe-nonce214099de7b3378791ee52c441260fc150ce07e4b14560b4d3595b6570265e902
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDdBOkRBNzQ0OjE4MDM1MTY6MjA0NUE4NDo2QjAxNTFBMSIsInZpc2l0b3JfaWQiOiI3NjIwNTM5NzI2MTAxMDQxNTcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3551557caba0787221ae420d27035e7631097427dd4dadd6e6b88a51dd9d7da5
hovercard-subject-tagissue:676044655
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.py/2698/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8ebf6fbfd1a00ea95c4fd4d5f82bc003dab2f069c0aca78138a6c93ec4e3776d/plotly/plotly.py/issues/2698
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8ebf6fbfd1a00ea95c4fd4d5f82bc003dab2f069c0aca78138a6c93ec4e3776d/plotly/plotly.py/issues/2698
og:image:altI am working in a Jupyter notebook and when accessing the selectedpoints attribute of a go.Histogram or the points list in the on_selection callback, the list does not contain integer indices of th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemeffmadd
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git
octolytics-dimension-user_id5997976
octolytics-dimension-user_loginplotly
octolytics-dimension-repository_id14579099
octolytics-dimension-repository_nwoplotly/plotly.py
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14579099
octolytics-dimension-repository_network_root_nwoplotly/plotly.py
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/plotly/plotly.py/issues/2698#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F2698
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F2698
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=plotly%2Fplotly.py
Reloadhttps://github.com/plotly/plotly.py/issues/2698
Reloadhttps://github.com/plotly/plotly.py/issues/2698
Reloadhttps://github.com/plotly/plotly.py/issues/2698
plotlyhttps://github.com/plotly
plotly.pyhttps://github.com/plotly/plotly.py
Codehttps://github.com/plotly/plotly.py
Issues650 (650)https://github.com/plotly/plotly.py/issues
Pull requests83 (83)https://github.com/plotly/plotly.py/pulls
Actionshttps://github.com/plotly/plotly.py/actions
Security and qualityhttps://github.com/plotly/plotly.py/security
Insightshttps://github.com/plotly/plotly.py/insights
https://github.com/plotly/plotly.py
New issuehttps://github.com/login?return_to=https://github.com/plotly/plotly.py/issues/2698
New issuehttps://github.com/login?return_to=https://github.com/plotly/plotly.py/issues/2698
#2711https://github.com/plotly/plotly.py/pull/2711
The selectedpoints attribute for Histogram plots is being set incorrectlyhttps://github.com/plotly/plotly.py/issues/2698#top
#2711https://github.com/plotly/plotly.py/pull/2711
https://github.com/meffmadd
meffmaddhttps://github.com/meffmadd
on Aug 10, 2020https://github.com/plotly/plotly.py/issues/2698#issue-676044655
https://codepen.io/meffmadd/pen/zYqGmawhttps://codepen.io/meffmadd/pen/zYqGmaw
plotly.py/packages/javascript/plotlywidget/src/Figure.jshttps://github.com/plotly/plotly.py/blob/efc66509526bdde772e8a8caaf1bcee865ccec3a/packages/javascript/plotlywidget/src/Figure.js#L1134
efc6650https://github.com/plotly/plotly.py/commit/efc66509526bdde772e8a8caaf1bcee865ccec3a
meffmaddhttps://github.com/meffmadd
on Aug 10, 2020https://github.com/plotly/plotly.py/issues/2698#event-3638716312
https://github.com/meffmadd
meffmaddhttps://github.com/meffmadd
on Aug 17, 2020https://github.com/plotly/plotly.py/issues/2698#issuecomment-674785363
plotly.py/packages/javascript/plotlywidget/src/Figure.jshttps://github.com/plotly/plotly.py/blob/efc66509526bdde772e8a8caaf1bcee865ccec3a/packages/javascript/plotlywidget/src/Figure.js#L885
efc6650https://github.com/plotly/plotly.py/commit/efc66509526bdde772e8a8caaf1bcee865ccec3a
jonmmeasehttps://github.com/jonmmease
completedhttps://github.com/plotly/plotly.py/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#2711https://github.com/plotly/plotly.py/pull/2711
on Sep 3, 2020https://github.com/plotly/plotly.py/issues/2698#event-3726227952
https://github.com/nicolaskruchten
nicolaskruchtenhttps://github.com/nicolaskruchten
on Sep 10, 2020https://github.com/plotly/plotly.py/issues/2698#issuecomment-690607953
https://community.plotly.com/t/announcing-plotly-py-4-10-date-axis-improvements-a-faster-px-imshow-and-full-figures-for-development/44685https://community.plotly.com/t/announcing-plotly-py-4-10-date-axis-improvements-a-faster-px-imshow-and-full-figures-for-development/44685
Sign up for freehttps://github.com/signup?return_to=https://github.com/plotly/plotly.py/issues/2698
Sign in to commenthttps://github.com/login?return_to=https://github.com/plotly/plotly.py/issues/2698
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.