Add quiver trace type for vector field visualization#7710
Add quiver trace type for vector field visualization#7710degzhaus wants to merge 34 commits intoplotly:masterfrom
Conversation
…n logic Co-authored-by: Cursor <cursoragent@cursor.com>
…dcoding hasColorscale to true
… and calendar handling
…h standard marker.color
…move hard-coded ranges from mocks
…eGuide showLine check
….textPointStyle utility
…for unselected arrows
…leDefaults captures its reference
259d03e to
37f9d6f
Compare
2b40a49 to
0c13caf
Compare
1262c1e to
f327f5d
Compare
|
Thanks again for the great comments, @emilykl ! I will attempt to reference commits inline from this comment here: -- Bug Fixes -- "The axis ranges don't automatically adjust to include the full length of the arrows" fixed here: "Colorscale seems broken in the latest version" fixed here: "Legends are missing icons" fixed here: " "The "Display of colorbars does not seem to work" fixed here: -- API Refinements -- " "The line options should be nested under marker.line", |
|
Here are the followups for the remaining 3 comments from: #7584, @emilykl : "Could we plausibly reuse the src/traces/scatter/select.js selectPoints() function" fixed here: "Should probably call the hasColorscale() function here" fixed here: "Can you look into whether we can/should use the handleXYDefaults() function here" fixed here: |
|
Alrighty, @emilykl , thanks again for your great feedback and patience as I addressed it! I have pushed all my fixes and tested locally, I think we're close 🤞 |
Overview
This PR adds a new
quivertrace type to Plotly.js for visualizing 2D vector fields using arrows.Continuation of #7584
Features
x,ycoordinates with direction/magnitude fromu,vcomponentsscaled(normalized),absolute, orrawvector lengths viasizemode/sizereftail,tip, orcenter/cm/middlecarray)line.*attributesarrowsizehovertemplate, point selectionx,y,u,v, andcarraysAPI
Screenshots
Examples taken from plotly.com/python/quiver-plots
Gist with example code
Basic Quiver Plot
With Colorscale
Testing
Files Changed
New files (
src/traces/quiver/)index.js- Trace module definitionattributes.js- Attribute schemadefaults.js- Default value handlingcalc.js- Data calculationplot.js- SVG renderingstyle.js- Stylinghover.js- Hover behaviorselect_points.js- Selection supportevent_data.js- Event data formattingformat_labels.js- Label formattingModified
lib/index.js&lib/index-strict.js- Build integrationTests
test/jasmine/tests/quiver_test.js- Unit teststest/image/mocks/quiver_*.json- 9 mock filestest/image/baselines/quiver_*.png- Baseline images