-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add scatterquiver trace type for vector field visualization #7584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
dfd3c81 to
9463b3f
Compare
|
Hello, I am new to this project and attempting to contribute my first PR. Unfortunately, I am struggling to get the build to pass. Specifically, the I tried running But still encountering the issue. Any insight would be greatly appreciated. Thank you! Edit: tagging a few recent commiters for visibility, thanks so much! (cc @camdecoster @alexshoe @emilykl) |
|
Hi @degzhaus, thank you for working on this contribution! As it stands currently, the devtools dashboard needs to be running in order for You can also download |
3a35763 to
1644aca
Compare
b07de7b to
a32678d
Compare
Thank you so much, @emilykl! That was very helpful and unblocked me.
Edit: @emilykl i figured it out! Pardon my flailing at last night. So exciting! I have a couple of tests to add and this will be ready for review. Thanks again for your insights and help! |
a32678d to
76b68f6
Compare
64cf31d to
02c37f5
Compare
|
@degzhaus Great news, glad you're unblocked! Thank you for your work on this. Quiver is a plot type we've gotten a lot of requests for. A few high-level comments on the API:
|
Amazing, thank you so much for taking a look and providing great guidance, Emily! Looking forward to spinning a cycle on this feedback. |
|
@degzhaus One more comment — it would be great to include colorscale attributes in |
I would suggest that this be capable of using any additional attribute of the data (e.g., another parallel data series), not just the magnitude. It can be very useful to color the vectors according to some independent state variable. |
As I understand it, the I think it was directly copied from Plotly.py's This is how it came to be in this PR; that doesn't mean that a better solution might not be to use the standard arrowhead-styling options mentioned in another comment. |
| }, | ||
| scale: { | ||
| valType: 'number', | ||
| dflt: 0.1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my only concern not already mentioned in others' comments; it's not clear that a default of 0.1 doesn't violate the "principle of least surprise".
Again I think this was copied verbatim from Plotly.py's figure_factory.create_quiver but it may be worth reviewing whether it's really the right choice.
@gpdf Ah! Yes, that seems right according to the code, thanks for the correction. But yeah, in cases where the Plotly.py |
|
@emilykl Would it be "Plotlyesque" for there to be an option to show arrows as " |
@gpdf The arrowhead attributes are poorly documented, but this is possible using the existing API — for an annotation, you can set |
Overview
This PR adds a new
scatterquivertrace type to Plotly.js for visualizing vector fields. The implementation includes:scatterquiverfor quiver/vector field plotsFeatures
Screenshots
Examples taken from:
https://plotly.com/python/quiver-plots/
Basic Quiver Plot
Quiver Plot with Points
Testing
Files Added/Modified
src/traces/scatterquiver/- Complete trace implementationlib/index.js&lib/index-strict.js- Build integrationtest/jasmine/tests/scatterquiver_test.js- Unit teststest/image/mocks/scatterquiver_*.json- Mock datatest/jasmine/assets/mock_lists.js- Test integrationDraft Log
draftlogs/7584_add.md- Changelog entryThis addresses the need for vector field visualization in Plotly.js, similar to matplotlib's quiver plots.