feat: add Violin trace type#412
Conversation
Add the `Violin` trace with the full plotly.js violin attribute surface: bandwidth, box (inner mini box plot), meanline, KDE span/spanmode, scalegroup/scalemode, side (split violins), points/jitter/pointpos, selected/unselected, quartilemethod, hoveron, and zorder. Grouped and split violins work via the existing `ViolinMode` layout attribute. Includes unit tests, a doctest, a statistical-charts example (basic, horizontal, split), and a book recipe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the placeholder box_plot.png thumbnail for the Violin Plots recipe with a generated 1024x680 violin image, and add the plotly#412 reference to the CHANGELOG entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the placeholder box_plot.png thumbnail for the Violin Plots recipe with a generated 1024x680 violin image, and add the plotly#412 reference to the CHANGELOG entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Type the violin `span` field as `NumOrStringCollection` instead of `Vec<f64>`. Plotly.js types `span` as an `info_array` of `any`, so date/category axis values must be allowed for manual KDE spans on non-numeric value axes. Numeric spans continue to work unchanged; add a test covering both numeric and date-string spans. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
See violin plots in action using this PR as a git dependency. |
|
Thank you for the PRs @jqnatividad! I will review them in the next couple of days. I do have one request though, can you give me rights to update the PR branches? I would prefer to rebase them locally before merging but I cannot push to your fork. |
|
Thanks @andrei-ng! Sent you a write-access collaborator invite on the dathere/plotly fork — once accepted you can rebase/push all the branches. Also flipped on "Allow edits by maintainers" for the open PRs (#410, #416, #417, #418). Let me know if anything still blocks you. Since the fork is org-owned, the maintainer-edits checkbox can be hit-or-miss, so the collaborator invite is the reliable route. |
Awesome! Thanks! |
Summary
resolves #411
Adds the
Violintrace type, matching the full attribute surface of plotly.js'sviolintrace.Violin plots visualize the distribution of numerical data using a kernel density estimate, optionally with an inner box plot, mean line, and sample points.
What's included
Violin<X, Y>trace with all violin-specific attributes:bandwidth,box(inner mini box plot),meanline,span/spanmode,scalegroup/scalemode,side(split violins),points/jitter/pointpos,selected/unselected,quartilemethod,hoveron,zorder,x0/y0, plus the standard base-trace attributes.ViolinBox,MeanLine,Selection/SelectionMarker, and enumsViolinPoints,ScaleMode,SpanMode,ViolinSide,HoverOn(reusesbox_plot::QuartileMethod).PlotType::Violin, module + re-exports intraces/mod.rsandlib.rs. Grouped/split violins work via the existingViolinModelayout attribute.statistical_chartsgains basic, horizontal, and split violin examples.Violin Plotsrecipe under Statistical Charts.Attribute names were verified against plotly.js
src/traces/violin/attributes.js.Checklist
cargo test -p plotlypasses (12 violin unit tests + doctest)cargo clippy --features all -- -D warnings -A deprecatedcleancargo +nightly fmt --allCHANGELOG.mdupdated🤖 Generated with Claude Code