ggrust 0.6.0__tar.gz → 0.6.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ggrust-0.6.0 → ggrust-0.6.2}/Cargo.lock +2 -2
- {ggrust-0.6.0 → ggrust-0.6.2}/Cargo.toml +1 -1
- {ggrust-0.6.0 → ggrust-0.6.2}/PKG-INFO +62 -47
- {ggrust-0.6.0 → ggrust-0.6.2}/README.md +61 -46
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/build/side.rs +137 -35
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/build.rs +18 -2
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/grid_share.rs +2 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/axis.rs +14 -1
- ggrust-0.6.2/crates/ggrust-core/src/layout/axis_mark.rs +382 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/mod.rs +39 -31
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/side.rs +26 -4
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/side_panel.rs +203 -24
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/continuous.rs +3 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/discrete.rs +3 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/position.rs +8 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/spec.rs +237 -9
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/guide.rs +4 -1
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/layer.rs +12 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/scale.rs +7 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/side.rs +164 -11
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/theme/mod.rs +336 -8
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/theme/values.rs +5 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/js/ggrust.js +26 -2
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/__init__.py +2 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/__init__.py +2 -1
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/guide.py +101 -2
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/scale.py +12 -2
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/side.py +124 -7
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/theme.py +68 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/LICENSE +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/THIRD_PARTY_NOTICES.md +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/Cargo.toml +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/examples/compare_letsplot.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/examples/render_points.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/LiberationMono-Bold.ttf +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/LiberationMono-BoldItalic.ttf +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/LiberationMono-Italic.ttf +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/LiberationMono-Regular.ttf +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/LiberationSans-Bold.ttf +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/LiberationSans-BoldItalic.ttf +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/LiberationSans-Italic.ttf +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/LiberationSans-Regular.ttf +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/fonts/OFL.txt +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/build/inspect.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/cluster/distance.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/cluster/hclust.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/cluster/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/coord/cartesian.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/coord/fixed.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/coord/flip.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/coord/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/data/as_discrete.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/data/column.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/data/correlation.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/data/group.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/data/inline.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/data/layer.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/data/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/data/resolution.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/error.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/facet.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/abline.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/area.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/area_ridges.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/bar.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/beeswarm.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/bin2d.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/blank.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/boxplot.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/bracket.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/contour.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/curve.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/half_boxplot.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/half_point.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/half_violin.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/hex.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/hover.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/image.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/interval.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/jitter.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/lines.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/mark.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/mark_label.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/mark_shape.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/path.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/point.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/pointinterval.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/polygon.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/quantiles.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/raster.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/rect.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/reference_line.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/repel.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/repel_layout.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/rug.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/segment.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/sina.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/size_unit.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/slab.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/smooth.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/step.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/text.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/tile.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/geom/violin.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/grid/inset.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/grid.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/grid_tags.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/interactive_legend.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/colorbar.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/dendrogram.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/facet.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/grid.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/legend.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/rotated.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/secondary.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/tag.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/layout/zoom.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/lib.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/parallel.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/parameters.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/position/dodge.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/position/identity.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/position/jitter.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/position/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/position/nudge.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/position/random.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/position/shift.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/position/stack.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/canvas.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/html.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/pdf.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/png.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/raster.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/sprite.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/svg.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/render/webfont.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/breaks.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/datetime.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/format.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/label_pattern.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/number_format.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/secondary.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/brewer.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/brewer_data.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/color.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/color_space.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/colormap.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/colormap_data.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/ggsci.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/ggsci_data.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/gradient.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/hue.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/identity.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/linetype.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/manual.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/numeric.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/shape.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/style/spec.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scale/transform.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scene/color.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scene/color_names.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scene/encoded_png.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scene/geometry.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scene/marker.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/scene/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/aesthetic.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/coord.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/facet.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/frames.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/inset.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/plot.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/subplots.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/spec/theme.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/beeswarm.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/bin.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/bin2d.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/binhex.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/boxplot.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/compare_means.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/contour.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/cor.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/count.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/density.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/density2d.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/density_1d.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/densityridges.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/distribution.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/ecdf.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/ellipse.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/ggdist_density.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/groups.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/hypothesis.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/identity.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/pointdensity.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/pointinterval.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/poly_eq.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/pubr_labels.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/quasirandom.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/r_density.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/sina.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/slab.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/smooth.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/sum.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/summary.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/stat/ydensity.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/style/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/suggest.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/text/estimate.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/text/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/text/registry.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/tooltip/content.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/tooltip/mod.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/src/tooltip/template.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/build_bracket.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/build_lines.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/build_point.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/build_regressions.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/build_text_halo.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/cluster_parity.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/data_columns.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/number_format.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/discrete_ordering.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/distributions.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/dotplot.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/faceted.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/grid.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/heatmap.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/image.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/pandas_categorical.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/polars_enum.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/primitives.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/ridge.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/umap_categorical.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/umap_continuous.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/violin_box.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/void_theme.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/volcano.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fixtures/specs/with_inline_data.json +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/fonts.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/golden/scene_showcase.svg +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/render_parity.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/render_scene.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/render_sprites.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/spec_fixtures.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-core/tests/spec_regressions.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-python/Cargo.toml +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/crates/ggrust-python/src/lib.rs +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/pyproject.toml +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/_data.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/_display.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/_ggrust.pyi +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/_render.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/_typing.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/bistro/__init__.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/bistro/corr.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/errors.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/export.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/fonts.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/mapping.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/coord.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/core.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/dendrogram.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/expand_limits.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/facet.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/geom.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/geom_beeswarm.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/geom_extras.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/geom_function.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/geom_halves.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/geom_imshow.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/geom_mark.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/geom_pointdensity.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/gggrid.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/gghighlight.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/ggtb.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/inset.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/label.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/new_scale.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/plot.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/position.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/rasterize.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/scale_color.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/scale_ggsci.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/scale_identity.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/scale_shape.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/scale_size.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/sec_axis.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/series_meta.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/stat.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/stat_ggdist.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/stat_pubr.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/subplots.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/tooltip.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot/util.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/plot_file.py +0 -0
- {ggrust-0.6.0 → ggrust-0.6.2}/python/ggrust/py.typed +0 -0
|
@@ -448,7 +448,7 @@ dependencies = [
|
|
|
448
448
|
|
|
449
449
|
[[package]]
|
|
450
450
|
name = "ggrust-core"
|
|
451
|
-
version = "0.6.
|
|
451
|
+
version = "0.6.2"
|
|
452
452
|
dependencies = [
|
|
453
453
|
"ahash",
|
|
454
454
|
"arrow-array",
|
|
@@ -473,7 +473,7 @@ dependencies = [
|
|
|
473
473
|
|
|
474
474
|
[[package]]
|
|
475
475
|
name = "ggrust-python"
|
|
476
|
-
version = "0.6.
|
|
476
|
+
version = "0.6.2"
|
|
477
477
|
dependencies = [
|
|
478
478
|
"ggrust-core",
|
|
479
479
|
"pyo3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ggrust
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
@@ -14,6 +14,13 @@ Requires-Python: >=3.11
|
|
|
14
14
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
15
15
|
Project-URL: Repository, https://github.com/datavil/ggrust
|
|
16
16
|
|
|
17
|
+
<p align="center">
|
|
18
|
+
<picture>
|
|
19
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/datavil/ggrust/main/assets/logo/ggrust-logo-dark.svg">
|
|
20
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/logo/ggrust-logo-light.svg" alt="ggrust logo" width="160">
|
|
21
|
+
</picture>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
17
24
|
# ggrust
|
|
18
25
|
|
|
19
26
|
[](https://github.com/datavil/ggrust)
|
|
@@ -24,9 +31,24 @@ The __Grammar of Graphics__, written in Rust, used from Python.
|
|
|
24
31
|
|
|
25
32
|
__ggrust__ is a plotting library with a [Lets-Plot](https://lets-plot.org/) compatible Python API. Plots are built the familiar ggplot way, layer by layer with `+`, while the stats, scales, layout and rendering all run in Rust.
|
|
26
33
|
|
|
27
|
-
It was started for [Cellestial](https://github.com/datavil/cellestial), which needed a maintained backend for its Lets-Plot based API.
|
|
34
|
+
It was started for [Cellestial](https://github.com/datavil/cellestial), which needed a maintained backend for its Lets-Plot based API.
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/clustered_heatmap.png" alt="Clustered heatmap with a row dendrogram and a side annotation track" width="49%">
|
|
38
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/cluster_marks.png" alt="Penguin species outlined by labelled hulls" width="49%">
|
|
39
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/side_panels.png" alt="Scatter plot with density side panels" width="49%">
|
|
40
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/compare_means.png" alt="Boxplots with significance brackets" width="49%">
|
|
41
|
+
</p>
|
|
42
|
+
|
|
43
|
+
<p align="center"><i>Every plot above is ggrust. More in the <a href="https://ggrust.datavil.org/gallery/">gallery</a>.</i></p>
|
|
44
|
+
|
|
45
|
+
## Highlights
|
|
28
46
|
|
|
29
|
-
|
|
47
|
+
- __Fast and lean__: a median __40x__ faster SVG, __22x__ faster PNG and __14x__ lower peak memory than Lets-Plot on identical work ([details](#performance)).
|
|
48
|
+
- __ggplot2 extensions, built in__: beeswarms, significance brackets, cluster marks, side panels, dendrograms, raincloud plots, patchwork layouts and more, under their R names ([list](#ggplot2-extensions-built-in)).
|
|
49
|
+
- __The Lets-Plot API__: most code ports with an import swap, `lets_plot` -> `ggrust`.
|
|
50
|
+
- __Interactive__: notebook and HTML output with tooltips, zoom and pan; dense point layers drawn on a canvas.
|
|
51
|
+
- __Publication output__: SVG, PNG, vector PDF and HTML, with your own fonts. Data crosses into Rust once, as Arrow, so [Polars](https://pola.rs/) and pandas frames work directly.
|
|
30
52
|
|
|
31
53
|
## Installation
|
|
32
54
|
|
|
@@ -68,7 +90,43 @@ plot.to_png("plot.png")
|
|
|
68
90
|
|
|
69
91
|
In a notebook the plot shows as interactive HTML (tooltips, zoom and pan with `ggtb()`).
|
|
70
92
|
|
|
71
|
-
##
|
|
93
|
+
## ggplot2 extensions, built in
|
|
94
|
+
|
|
95
|
+
Many popular ggplot2 extension packages from R are built into ggrust, under their R function names. Nothing extra to install; Lets-Plot has none of them.
|
|
96
|
+
|
|
97
|
+
| Feature | ggrust | From the R package |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| Beeswarm and quasirandom points | `geom_beeswarm`, `geom_quasirandom` | [ggbeeswarm](https://cran.r-project.org/package=ggbeeswarm) |
|
|
100
|
+
| Journal color palettes | `scale_color_npg`, `_aaas`, `_nejm`, `_lancet`, `_jama`, `_jco`, `_d3`, `_igv` | [ggsci](https://cran.r-project.org/package=ggsci) |
|
|
101
|
+
| Significance tests and labels | `stat_compare_means`, `stat_cor`, `stat_poly_eq` | [ggpubr](https://cran.r-project.org/package=ggpubr), [ggpmisc](https://cran.r-project.org/package=ggpmisc) |
|
|
102
|
+
| Cluster marks | `geom_mark_hull`, `geom_mark_ellipse`, `geom_mark_rect` | [ggforce](https://cran.r-project.org/package=ggforce) |
|
|
103
|
+
| Highlighting | `gghighlight` | [gghighlight](https://cran.r-project.org/package=gghighlight) |
|
|
104
|
+
| Point density | `geom_pointdensity` | [ggpointdensity](https://cran.r-project.org/package=ggpointdensity) |
|
|
105
|
+
| Side panels | `geom_xside*`, `geom_yside*`, `ggmarginal` | [ggside](https://cran.r-project.org/package=ggside) |
|
|
106
|
+
| Several color scales in one plot | `new_scale_fill`, `new_scale_color`, `new_scale` | [ggnewscale](https://cran.r-project.org/package=ggnewscale) |
|
|
107
|
+
| Dendrograms | `hclust`, `scale_x_dendro`, `scale_y_dendro`, `geom_dendrogram` | [legendry](https://cran.r-project.org/package=legendry), [ggh4x](https://cran.r-project.org/package=ggh4x), [ggdendro](https://cran.r-project.org/package=ggdendro) |
|
|
108
|
+
| Raincloud plots | `stat_halfeye`, `stat_interval`, `geom_half_violin`, `geom_half_boxplot`, `geom_half_point` | [ggdist](https://cran.r-project.org/package=ggdist), [gghalves](https://cran.r-project.org/package=gghalves) |
|
|
109
|
+
| Figure layouts and panel tags | `gggrid(design=, tag_levels=)`, `inset_element` | [patchwork](https://cran.r-project.org/package=patchwork) |
|
|
110
|
+
| Rasterized layers in vector output | `rasterize` | [ggrastr](https://cran.r-project.org/package=ggrastr), [scattermore](https://cran.r-project.org/package=scattermore) |
|
|
111
|
+
|
|
112
|
+
ggrust reimplements their behavior in Rust; the R packages and their authors designed it. Examples and credits are in the [extensions guide](https://ggrust.datavil.org/guide/extensions/).
|
|
113
|
+
|
|
114
|
+
## Performance
|
|
115
|
+
|
|
116
|
+
Compared with Lets-Plot on identical work: same data, every row drawn (Lets-Plot sampling turned off), same output size. Measured on an Apple M4 Pro, ggrust 0.1.0 vs lets-plot 4.11.0.
|
|
117
|
+
|
|
118
|
+
- __Speed__: SVG a median __40x__ faster (5x to 185x over 23 cases), PNG a median __22x__ faster (13x to 119x).
|
|
119
|
+
- __Memory__: a median __14x__ lower peak memory (3.6x to 220x). A 1M-point scatter PNG peaks at 44 MB above the data in ggrust and 9.6 GB in Lets-Plot.
|
|
120
|
+
- No case was slower. The weakest spots are point-heavy PNGs (13x to 21x) and large SVGs, where ggrust still peaks at 430 MB for 1M points.
|
|
121
|
+
|
|
122
|
+
<p align="center">
|
|
123
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/benchmarks/report-speedup.png" alt="Speed-up over Lets-Plot per case" width="49%">
|
|
124
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/benchmarks/report-memory.png" alt="Peak memory ratio over Lets-Plot per case" width="49%">
|
|
125
|
+
</p>
|
|
126
|
+
|
|
127
|
+
Full methodology, raw numbers and side-by-side output images are in the [benchmark report](benchmarks/REPORT.md).
|
|
128
|
+
|
|
129
|
+
## More examples
|
|
72
130
|
|
|
73
131
|
### Distributions
|
|
74
132
|
|
|
@@ -151,49 +209,6 @@ temperature = pl.DataFrame(
|
|
|
151
209
|
|
|
152
210
|
ggrust is a __subset__ of Lets-Plot, not all of it. Features follow what Cellestial and everyday plotting need. See the [migration note](https://ggrust.datavil.org/migration/) for the differences.
|
|
153
211
|
|
|
154
|
-
## ggplot2 extensions, built in
|
|
155
|
-
|
|
156
|
-
Many popular ggplot2 extension packages from R are built into ggrust, under their R function names. Nothing extra to install; Lets-Plot has none of them.
|
|
157
|
-
|
|
158
|
-
| Feature | ggrust | From the R package |
|
|
159
|
-
|---|---|---|
|
|
160
|
-
| Beeswarm and quasirandom points | `geom_beeswarm`, `geom_quasirandom` | [ggbeeswarm](https://cran.r-project.org/package=ggbeeswarm) |
|
|
161
|
-
| Journal color palettes | `scale_color_npg`, `_aaas`, `_nejm`, `_lancet`, `_jama`, `_jco`, `_d3`, `_igv` | [ggsci](https://cran.r-project.org/package=ggsci) |
|
|
162
|
-
| Significance tests and labels | `stat_compare_means`, `stat_cor`, `stat_poly_eq` | [ggpubr](https://cran.r-project.org/package=ggpubr), [ggpmisc](https://cran.r-project.org/package=ggpmisc) |
|
|
163
|
-
| Cluster marks | `geom_mark_hull`, `geom_mark_ellipse`, `geom_mark_rect` | [ggforce](https://cran.r-project.org/package=ggforce) |
|
|
164
|
-
| Highlighting | `gghighlight` | [gghighlight](https://cran.r-project.org/package=gghighlight) |
|
|
165
|
-
| Point density | `geom_pointdensity` | [ggpointdensity](https://cran.r-project.org/package=ggpointdensity) |
|
|
166
|
-
| Side panels | `geom_xside*`, `geom_yside*`, `ggmarginal` | [ggside](https://cran.r-project.org/package=ggside) |
|
|
167
|
-
| Several color scales in one plot | `new_scale_fill`, `new_scale_color`, `new_scale` | [ggnewscale](https://cran.r-project.org/package=ggnewscale) |
|
|
168
|
-
| Dendrograms | `hclust`, `scale_x_dendro`, `scale_y_dendro`, `geom_dendrogram` | [legendry](https://cran.r-project.org/package=legendry), [ggh4x](https://cran.r-project.org/package=ggh4x), [ggdendro](https://cran.r-project.org/package=ggdendro) |
|
|
169
|
-
| Raincloud plots | `stat_halfeye`, `stat_interval`, `geom_half_violin`, `geom_half_boxplot`, `geom_half_point` | [ggdist](https://cran.r-project.org/package=ggdist), [gghalves](https://cran.r-project.org/package=gghalves) |
|
|
170
|
-
| Figure layouts and panel tags | `gggrid(design=, tag_levels=)`, `inset_element` | [patchwork](https://cran.r-project.org/package=patchwork) |
|
|
171
|
-
| Rasterized layers in vector output | `rasterize` | [ggrastr](https://cran.r-project.org/package=ggrastr), [scattermore](https://cran.r-project.org/package=scattermore) |
|
|
172
|
-
|
|
173
|
-
ggrust reimplements their behavior in Rust; the R packages and their authors designed it. Examples and credits are in the [extensions guide](https://ggrust.datavil.org/guide/extensions/).
|
|
174
|
-
|
|
175
|
-
<p align="center">
|
|
176
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/clustered_heatmap.png" alt="Clustered heatmap with a row dendrogram and a side annotation track" width="49%">
|
|
177
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/cluster_marks.png" alt="Penguin species outlined by labelled hulls" width="49%">
|
|
178
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/side_panels.png" alt="Scatter plot with density side panels" width="49%">
|
|
179
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/compare_means.png" alt="Boxplots with significance brackets" width="49%">
|
|
180
|
-
</p>
|
|
181
|
-
|
|
182
|
-
## Performance
|
|
183
|
-
|
|
184
|
-
Compared with Lets-Plot on identical work: same data, every row drawn (Lets-Plot sampling turned off), same output size. Measured on an Apple M4 Pro, ggrust 0.1.0 vs lets-plot 4.11.0.
|
|
185
|
-
|
|
186
|
-
- __Speed__: SVG a median __40x__ faster (5x to 185x over 23 cases), PNG a median __22x__ faster (13x to 119x).
|
|
187
|
-
- __Memory__: a median __14x__ lower peak memory (3.6x to 220x). A 1M-point scatter PNG peaks at 44 MB above the data in ggrust and 9.6 GB in Lets-Plot.
|
|
188
|
-
- No case was slower. The weakest spots are point-heavy PNGs (13x to 21x) and large SVGs, where ggrust still peaks at 430 MB for 1M points.
|
|
189
|
-
|
|
190
|
-
<p align="center">
|
|
191
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/benchmarks/report-speedup.png" alt="Speed-up over Lets-Plot per case" width="49%">
|
|
192
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/benchmarks/report-memory.png" alt="Peak memory ratio over Lets-Plot per case" width="49%">
|
|
193
|
-
</p>
|
|
194
|
-
|
|
195
|
-
Full methodology, raw numbers and side-by-side output images are in the [benchmark report](benchmarks/REPORT.md).
|
|
196
|
-
|
|
197
212
|
## Status
|
|
198
213
|
|
|
199
214
|
Early, but usable: the full Cellestial test suite passes on ggrust. Expect rough edges and API gaps; issues are welcome.
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/datavil/ggrust/main/assets/logo/ggrust-logo-dark.svg">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/logo/ggrust-logo-light.svg" alt="ggrust logo" width="160">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
1
8
|
# ggrust
|
|
2
9
|
|
|
3
10
|
[](https://github.com/datavil/ggrust)
|
|
@@ -8,9 +15,24 @@ The __Grammar of Graphics__, written in Rust, used from Python.
|
|
|
8
15
|
|
|
9
16
|
__ggrust__ is a plotting library with a [Lets-Plot](https://lets-plot.org/) compatible Python API. Plots are built the familiar ggplot way, layer by layer with `+`, while the stats, scales, layout and rendering all run in Rust.
|
|
10
17
|
|
|
11
|
-
It was started for [Cellestial](https://github.com/datavil/cellestial), which needed a maintained backend for its Lets-Plot based API.
|
|
18
|
+
It was started for [Cellestial](https://github.com/datavil/cellestial), which needed a maintained backend for its Lets-Plot based API.
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/clustered_heatmap.png" alt="Clustered heatmap with a row dendrogram and a side annotation track" width="49%">
|
|
22
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/cluster_marks.png" alt="Penguin species outlined by labelled hulls" width="49%">
|
|
23
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/side_panels.png" alt="Scatter plot with density side panels" width="49%">
|
|
24
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/compare_means.png" alt="Boxplots with significance brackets" width="49%">
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<p align="center"><i>Every plot above is ggrust. More in the <a href="https://ggrust.datavil.org/gallery/">gallery</a>.</i></p>
|
|
28
|
+
|
|
29
|
+
## Highlights
|
|
12
30
|
|
|
13
|
-
|
|
31
|
+
- __Fast and lean__: a median __40x__ faster SVG, __22x__ faster PNG and __14x__ lower peak memory than Lets-Plot on identical work ([details](#performance)).
|
|
32
|
+
- __ggplot2 extensions, built in__: beeswarms, significance brackets, cluster marks, side panels, dendrograms, raincloud plots, patchwork layouts and more, under their R names ([list](#ggplot2-extensions-built-in)).
|
|
33
|
+
- __The Lets-Plot API__: most code ports with an import swap, `lets_plot` -> `ggrust`.
|
|
34
|
+
- __Interactive__: notebook and HTML output with tooltips, zoom and pan; dense point layers drawn on a canvas.
|
|
35
|
+
- __Publication output__: SVG, PNG, vector PDF and HTML, with your own fonts. Data crosses into Rust once, as Arrow, so [Polars](https://pola.rs/) and pandas frames work directly.
|
|
14
36
|
|
|
15
37
|
## Installation
|
|
16
38
|
|
|
@@ -52,7 +74,43 @@ plot.to_png("plot.png")
|
|
|
52
74
|
|
|
53
75
|
In a notebook the plot shows as interactive HTML (tooltips, zoom and pan with `ggtb()`).
|
|
54
76
|
|
|
55
|
-
##
|
|
77
|
+
## ggplot2 extensions, built in
|
|
78
|
+
|
|
79
|
+
Many popular ggplot2 extension packages from R are built into ggrust, under their R function names. Nothing extra to install; Lets-Plot has none of them.
|
|
80
|
+
|
|
81
|
+
| Feature | ggrust | From the R package |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| Beeswarm and quasirandom points | `geom_beeswarm`, `geom_quasirandom` | [ggbeeswarm](https://cran.r-project.org/package=ggbeeswarm) |
|
|
84
|
+
| Journal color palettes | `scale_color_npg`, `_aaas`, `_nejm`, `_lancet`, `_jama`, `_jco`, `_d3`, `_igv` | [ggsci](https://cran.r-project.org/package=ggsci) |
|
|
85
|
+
| Significance tests and labels | `stat_compare_means`, `stat_cor`, `stat_poly_eq` | [ggpubr](https://cran.r-project.org/package=ggpubr), [ggpmisc](https://cran.r-project.org/package=ggpmisc) |
|
|
86
|
+
| Cluster marks | `geom_mark_hull`, `geom_mark_ellipse`, `geom_mark_rect` | [ggforce](https://cran.r-project.org/package=ggforce) |
|
|
87
|
+
| Highlighting | `gghighlight` | [gghighlight](https://cran.r-project.org/package=gghighlight) |
|
|
88
|
+
| Point density | `geom_pointdensity` | [ggpointdensity](https://cran.r-project.org/package=ggpointdensity) |
|
|
89
|
+
| Side panels | `geom_xside*`, `geom_yside*`, `ggmarginal` | [ggside](https://cran.r-project.org/package=ggside) |
|
|
90
|
+
| Several color scales in one plot | `new_scale_fill`, `new_scale_color`, `new_scale` | [ggnewscale](https://cran.r-project.org/package=ggnewscale) |
|
|
91
|
+
| Dendrograms | `hclust`, `scale_x_dendro`, `scale_y_dendro`, `geom_dendrogram` | [legendry](https://cran.r-project.org/package=legendry), [ggh4x](https://cran.r-project.org/package=ggh4x), [ggdendro](https://cran.r-project.org/package=ggdendro) |
|
|
92
|
+
| Raincloud plots | `stat_halfeye`, `stat_interval`, `geom_half_violin`, `geom_half_boxplot`, `geom_half_point` | [ggdist](https://cran.r-project.org/package=ggdist), [gghalves](https://cran.r-project.org/package=gghalves) |
|
|
93
|
+
| Figure layouts and panel tags | `gggrid(design=, tag_levels=)`, `inset_element` | [patchwork](https://cran.r-project.org/package=patchwork) |
|
|
94
|
+
| Rasterized layers in vector output | `rasterize` | [ggrastr](https://cran.r-project.org/package=ggrastr), [scattermore](https://cran.r-project.org/package=scattermore) |
|
|
95
|
+
|
|
96
|
+
ggrust reimplements their behavior in Rust; the R packages and their authors designed it. Examples and credits are in the [extensions guide](https://ggrust.datavil.org/guide/extensions/).
|
|
97
|
+
|
|
98
|
+
## Performance
|
|
99
|
+
|
|
100
|
+
Compared with Lets-Plot on identical work: same data, every row drawn (Lets-Plot sampling turned off), same output size. Measured on an Apple M4 Pro, ggrust 0.1.0 vs lets-plot 4.11.0.
|
|
101
|
+
|
|
102
|
+
- __Speed__: SVG a median __40x__ faster (5x to 185x over 23 cases), PNG a median __22x__ faster (13x to 119x).
|
|
103
|
+
- __Memory__: a median __14x__ lower peak memory (3.6x to 220x). A 1M-point scatter PNG peaks at 44 MB above the data in ggrust and 9.6 GB in Lets-Plot.
|
|
104
|
+
- No case was slower. The weakest spots are point-heavy PNGs (13x to 21x) and large SVGs, where ggrust still peaks at 430 MB for 1M points.
|
|
105
|
+
|
|
106
|
+
<p align="center">
|
|
107
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/benchmarks/report-speedup.png" alt="Speed-up over Lets-Plot per case" width="49%">
|
|
108
|
+
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/benchmarks/report-memory.png" alt="Peak memory ratio over Lets-Plot per case" width="49%">
|
|
109
|
+
</p>
|
|
110
|
+
|
|
111
|
+
Full methodology, raw numbers and side-by-side output images are in the [benchmark report](benchmarks/REPORT.md).
|
|
112
|
+
|
|
113
|
+
## More examples
|
|
56
114
|
|
|
57
115
|
### Distributions
|
|
58
116
|
|
|
@@ -135,49 +193,6 @@ temperature = pl.DataFrame(
|
|
|
135
193
|
|
|
136
194
|
ggrust is a __subset__ of Lets-Plot, not all of it. Features follow what Cellestial and everyday plotting need. See the [migration note](https://ggrust.datavil.org/migration/) for the differences.
|
|
137
195
|
|
|
138
|
-
## ggplot2 extensions, built in
|
|
139
|
-
|
|
140
|
-
Many popular ggplot2 extension packages from R are built into ggrust, under their R function names. Nothing extra to install; Lets-Plot has none of them.
|
|
141
|
-
|
|
142
|
-
| Feature | ggrust | From the R package |
|
|
143
|
-
|---|---|---|
|
|
144
|
-
| Beeswarm and quasirandom points | `geom_beeswarm`, `geom_quasirandom` | [ggbeeswarm](https://cran.r-project.org/package=ggbeeswarm) |
|
|
145
|
-
| Journal color palettes | `scale_color_npg`, `_aaas`, `_nejm`, `_lancet`, `_jama`, `_jco`, `_d3`, `_igv` | [ggsci](https://cran.r-project.org/package=ggsci) |
|
|
146
|
-
| Significance tests and labels | `stat_compare_means`, `stat_cor`, `stat_poly_eq` | [ggpubr](https://cran.r-project.org/package=ggpubr), [ggpmisc](https://cran.r-project.org/package=ggpmisc) |
|
|
147
|
-
| Cluster marks | `geom_mark_hull`, `geom_mark_ellipse`, `geom_mark_rect` | [ggforce](https://cran.r-project.org/package=ggforce) |
|
|
148
|
-
| Highlighting | `gghighlight` | [gghighlight](https://cran.r-project.org/package=gghighlight) |
|
|
149
|
-
| Point density | `geom_pointdensity` | [ggpointdensity](https://cran.r-project.org/package=ggpointdensity) |
|
|
150
|
-
| Side panels | `geom_xside*`, `geom_yside*`, `ggmarginal` | [ggside](https://cran.r-project.org/package=ggside) |
|
|
151
|
-
| Several color scales in one plot | `new_scale_fill`, `new_scale_color`, `new_scale` | [ggnewscale](https://cran.r-project.org/package=ggnewscale) |
|
|
152
|
-
| Dendrograms | `hclust`, `scale_x_dendro`, `scale_y_dendro`, `geom_dendrogram` | [legendry](https://cran.r-project.org/package=legendry), [ggh4x](https://cran.r-project.org/package=ggh4x), [ggdendro](https://cran.r-project.org/package=ggdendro) |
|
|
153
|
-
| Raincloud plots | `stat_halfeye`, `stat_interval`, `geom_half_violin`, `geom_half_boxplot`, `geom_half_point` | [ggdist](https://cran.r-project.org/package=ggdist), [gghalves](https://cran.r-project.org/package=gghalves) |
|
|
154
|
-
| Figure layouts and panel tags | `gggrid(design=, tag_levels=)`, `inset_element` | [patchwork](https://cran.r-project.org/package=patchwork) |
|
|
155
|
-
| Rasterized layers in vector output | `rasterize` | [ggrastr](https://cran.r-project.org/package=ggrastr), [scattermore](https://cran.r-project.org/package=scattermore) |
|
|
156
|
-
|
|
157
|
-
ggrust reimplements their behavior in Rust; the R packages and their authors designed it. Examples and credits are in the [extensions guide](https://ggrust.datavil.org/guide/extensions/).
|
|
158
|
-
|
|
159
|
-
<p align="center">
|
|
160
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/clustered_heatmap.png" alt="Clustered heatmap with a row dendrogram and a side annotation track" width="49%">
|
|
161
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/cluster_marks.png" alt="Penguin species outlined by labelled hulls" width="49%">
|
|
162
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/side_panels.png" alt="Scatter plot with density side panels" width="49%">
|
|
163
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/assets/compare_means.png" alt="Boxplots with significance brackets" width="49%">
|
|
164
|
-
</p>
|
|
165
|
-
|
|
166
|
-
## Performance
|
|
167
|
-
|
|
168
|
-
Compared with Lets-Plot on identical work: same data, every row drawn (Lets-Plot sampling turned off), same output size. Measured on an Apple M4 Pro, ggrust 0.1.0 vs lets-plot 4.11.0.
|
|
169
|
-
|
|
170
|
-
- __Speed__: SVG a median __40x__ faster (5x to 185x over 23 cases), PNG a median __22x__ faster (13x to 119x).
|
|
171
|
-
- __Memory__: a median __14x__ lower peak memory (3.6x to 220x). A 1M-point scatter PNG peaks at 44 MB above the data in ggrust and 9.6 GB in Lets-Plot.
|
|
172
|
-
- No case was slower. The weakest spots are point-heavy PNGs (13x to 21x) and large SVGs, where ggrust still peaks at 430 MB for 1M points.
|
|
173
|
-
|
|
174
|
-
<p align="center">
|
|
175
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/benchmarks/report-speedup.png" alt="Speed-up over Lets-Plot per case" width="49%">
|
|
176
|
-
<img src="https://raw.githubusercontent.com/datavil/ggrust/main/benchmarks/report-memory.png" alt="Peak memory ratio over Lets-Plot per case" width="49%">
|
|
177
|
-
</p>
|
|
178
|
-
|
|
179
|
-
Full methodology, raw numbers and side-by-side output images are in the [benchmark report](benchmarks/REPORT.md).
|
|
180
|
-
|
|
181
196
|
## Status
|
|
182
197
|
|
|
183
198
|
Early, but usable: the full Cellestial test suite passes on ggrust. Expect rough edges and API gaps; issues are welcome.
|
|
@@ -20,14 +20,17 @@ use crate::theme::Theme;
|
|
|
20
20
|
use crate::{Error, Result};
|
|
21
21
|
|
|
22
22
|
/// A band and what its layers ask of it (before its scale is built).
|
|
23
|
-
#[derive(Debug, Clone,
|
|
23
|
+
#[derive(Debug, Clone, PartialEq)]
|
|
24
24
|
pub(super) struct BandSetup {
|
|
25
25
|
pub key: BandKey,
|
|
26
26
|
/// ggside if any of its layers is a ggside layer, else marginal.
|
|
27
27
|
pub style: BandStyle,
|
|
28
|
-
///
|
|
29
|
-
///
|
|
30
|
-
|
|
28
|
+
/// The largest size its layers of that style give: `side_size` (share of the
|
|
29
|
+
/// panel) for a ggside band, `margin_size` for a marginal one; `None`: the
|
|
30
|
+
/// default (`ggside_panel_scale_*`, lets-plot's 0.1).
|
|
31
|
+
pub size: Option<f64>,
|
|
32
|
+
/// The `side_band` name of its layers (`None`: the side's unnamed band).
|
|
33
|
+
pub name: Option<String>,
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
/// A prepared band: its setup and its own trained scale (data terms: the y scale
|
|
@@ -39,47 +42,73 @@ pub(super) struct SideBand {
|
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
/// The bands of a plot (sorted by key) and each layer's band index.
|
|
45
|
+
///
|
|
46
|
+
/// Layers on the same side with the same `side_band` name (or none) share a band.
|
|
47
|
+
/// The bands on one side get their slot, from the panel outward, in the order of
|
|
48
|
+
/// their first layer.
|
|
42
49
|
pub(super) fn band_setups(sides: &[Option<LayerSide>]) -> (Vec<BandSetup>, Vec<Option<usize>>) {
|
|
43
50
|
let mut setups: Vec<BandSetup> = Vec::new();
|
|
51
|
+
let same = |setup: &BandSetup, side: &LayerSide| {
|
|
52
|
+
setup.key.shares_x == side.band.shares_x
|
|
53
|
+
&& setup.key.far == side.band.far
|
|
54
|
+
&& setup.name == side.name
|
|
55
|
+
};
|
|
44
56
|
for side in sides.iter().flatten() {
|
|
45
|
-
match setups.iter_mut().find(|setup| setup
|
|
57
|
+
match setups.iter_mut().find(|setup| same(setup, side)) {
|
|
46
58
|
Some(setup) => {
|
|
47
59
|
if side.style == BandStyle::Ggside {
|
|
48
60
|
setup.style = BandStyle::Ggside;
|
|
49
61
|
}
|
|
50
|
-
if let Some(size) = side.size {
|
|
51
|
-
setup.size = if setup.size_given() {
|
|
52
|
-
setup.size.max(size)
|
|
53
|
-
} else {
|
|
54
|
-
size
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
62
|
}
|
|
58
|
-
None =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
None => {
|
|
64
|
+
let slot = setups
|
|
65
|
+
.iter()
|
|
66
|
+
.filter(|setup| {
|
|
67
|
+
setup.key.shares_x == side.band.shares_x && setup.key.far == side.band.far
|
|
68
|
+
})
|
|
69
|
+
.count();
|
|
70
|
+
setups.push(BandSetup {
|
|
71
|
+
key: BandKey { slot, ..side.band },
|
|
72
|
+
style: side.style,
|
|
73
|
+
size: None,
|
|
74
|
+
name: side.name.clone(),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
// Sizes count only from layers of the band's final style (a margin's
|
|
80
|
+
// `margin_size` is not a ggside panel share).
|
|
81
|
+
for side in sides.iter().flatten() {
|
|
82
|
+
if let (Some(size), Some(setup)) =
|
|
83
|
+
(side.size, setups.iter_mut().find(|setup| same(setup, side)))
|
|
84
|
+
&& side.style == setup.style
|
|
85
|
+
{
|
|
86
|
+
setup.size = Some(setup.size.map_or(size, |current| current.max(size)));
|
|
87
|
+
}
|
|
67
88
|
}
|
|
68
|
-
|
|
69
|
-
let bands = sides
|
|
89
|
+
let bands: Vec<Option<usize>> = sides
|
|
70
90
|
.iter()
|
|
71
|
-
.map(|side|
|
|
91
|
+
.map(|side| {
|
|
92
|
+
side.as_ref()
|
|
93
|
+
.and_then(|side| setups.iter().position(|setup| same(setup, side)))
|
|
94
|
+
})
|
|
72
95
|
.collect();
|
|
73
|
-
|
|
96
|
+
// Sort by key, keeping each layer's index pointing at its band.
|
|
97
|
+
let mut order: Vec<usize> = (0..setups.len()).collect();
|
|
98
|
+
order.sort_by_key(|index| setups[*index].key);
|
|
99
|
+
let mut new_index = vec![0; setups.len()];
|
|
100
|
+
for (new, old) in order.iter().enumerate() {
|
|
101
|
+
new_index[*old] = new;
|
|
102
|
+
}
|
|
103
|
+
let sorted = order.iter().map(|index| setups[*index].clone()).collect();
|
|
104
|
+
let bands = bands
|
|
105
|
+
.into_iter()
|
|
106
|
+
.map(|band| band.map(|band| new_index[band]))
|
|
107
|
+
.collect();
|
|
108
|
+
(sorted, bands)
|
|
74
109
|
}
|
|
75
110
|
|
|
76
111
|
impl BandSetup {
|
|
77
|
-
/// Whether a layer gave `margin_size` (a default size is stored negated until
|
|
78
|
-
/// [`band_setups`] ends).
|
|
79
|
-
fn size_given(&self) -> bool {
|
|
80
|
-
self.size >= 0.0
|
|
81
|
-
}
|
|
82
|
-
|
|
83
112
|
/// The data aesthetic across the band (y for a band sharing x).
|
|
84
113
|
pub fn cross_aesthetic(&self) -> Aesthetic {
|
|
85
114
|
if self.key.shares_x {
|
|
@@ -102,7 +131,15 @@ impl BandSetup {
|
|
|
102
131
|
|
|
103
132
|
/// The options of the band's own scale: `scale_xsidey_*()` / `scale_ysidex_*()`
|
|
104
133
|
/// for a ggside band; a margin's grows away from the panel below and left.
|
|
134
|
+
/// A ggside band takes the most specific `scale_*side*_*(side_pos=, side_band=)`
|
|
135
|
+
/// that targets it (see [`PositionScales::side_spec`]).
|
|
105
136
|
pub fn cross_spec(&self, scales: &PositionScales) -> AxisScaleSpec {
|
|
137
|
+
if self.style == BandStyle::Ggside
|
|
138
|
+
&& let Some(spec) =
|
|
139
|
+
scales.side_spec(self.key.shares_x, self.key.far, self.name.as_deref())
|
|
140
|
+
{
|
|
141
|
+
return spec.clone();
|
|
142
|
+
}
|
|
106
143
|
match (self.style, self.key.shares_x) {
|
|
107
144
|
(BandStyle::Ggside, true) => scales.xside_y.clone(),
|
|
108
145
|
(BandStyle::Ggside, false) => scales.yside_x.clone(),
|
|
@@ -205,11 +242,11 @@ pub(super) fn band_requests<'a>(
|
|
|
205
242
|
let (size, spacing) = match band.setup.style {
|
|
206
243
|
BandStyle::Ggside => {
|
|
207
244
|
let (x_share, y_share) = theme.ggside_panel_scale;
|
|
208
|
-
let share = if band.setup.key.shares_x {
|
|
245
|
+
let share = band.setup.size.unwrap_or(if band.setup.key.shares_x {
|
|
209
246
|
x_share
|
|
210
247
|
} else {
|
|
211
248
|
y_share
|
|
212
|
-
};
|
|
249
|
+
});
|
|
213
250
|
let (horizontal_gap, vertical_gap) = theme.ggside_panel_spacing;
|
|
214
251
|
let spacing = if side.is_horizontal() {
|
|
215
252
|
vertical_gap
|
|
@@ -218,7 +255,10 @@ pub(super) fn band_requests<'a>(
|
|
|
218
255
|
};
|
|
219
256
|
(BandSize::OfPanel(share), spacing)
|
|
220
257
|
}
|
|
221
|
-
BandStyle::Marginal => (
|
|
258
|
+
BandStyle::Marginal => (
|
|
259
|
+
BandSize::OfTotal(band.setup.size.unwrap_or(DEFAULT_MARGIN_SIZE)),
|
|
260
|
+
0.0,
|
|
261
|
+
),
|
|
222
262
|
};
|
|
223
263
|
BandRequest {
|
|
224
264
|
side,
|
|
@@ -322,9 +362,21 @@ mod tests {
|
|
|
322
362
|
|
|
323
363
|
fn side(shares_x: bool, far: bool, style: BandStyle, size: Option<f64>) -> Option<LayerSide> {
|
|
324
364
|
Some(LayerSide {
|
|
325
|
-
band: BandKey {
|
|
365
|
+
band: BandKey {
|
|
366
|
+
shares_x,
|
|
367
|
+
far,
|
|
368
|
+
slot: 0,
|
|
369
|
+
},
|
|
326
370
|
style,
|
|
327
371
|
size,
|
|
372
|
+
name: None,
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
fn named(shares_x: bool, far: bool, name: &str, size: Option<f64>) -> Option<LayerSide> {
|
|
377
|
+
side(shares_x, far, BandStyle::Ggside, size).map(|side| LayerSide {
|
|
378
|
+
name: Some(name.to_owned()),
|
|
379
|
+
..side
|
|
328
380
|
})
|
|
329
381
|
}
|
|
330
382
|
|
|
@@ -341,8 +393,58 @@ mod tests {
|
|
|
341
393
|
assert_eq!(setups.len(), 2);
|
|
342
394
|
assert_eq!(bands, vec![None, Some(1), Some(0), Some(1), Some(0)]);
|
|
343
395
|
assert_eq!(setups[0].style, BandStyle::Marginal);
|
|
344
|
-
|
|
345
|
-
|
|
396
|
+
assert_eq!(setups[0].size, Some(0.2));
|
|
397
|
+
assert_eq!(setups[1].size, None);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
#[test]
|
|
401
|
+
fn named_bands_stack_outward_in_plot_order() {
|
|
402
|
+
let sides = [
|
|
403
|
+
None,
|
|
404
|
+
named(false, false, "score", None),
|
|
405
|
+
side(false, true, BandStyle::Ggside, None),
|
|
406
|
+
side(false, false, BandStyle::Ggside, Some(0.05)),
|
|
407
|
+
named(false, false, "score", Some(0.2)),
|
|
408
|
+
named(false, false, "other", Some(0.1)),
|
|
409
|
+
named(false, false, "score", Some(0.3)),
|
|
410
|
+
];
|
|
411
|
+
let (setups, bands) = band_setups(&sides);
|
|
412
|
+
// Left bands first (far = false), by slot; then the right band.
|
|
413
|
+
let summary: Vec<(bool, usize, Option<&str>, Option<f64>)> = setups
|
|
414
|
+
.iter()
|
|
415
|
+
.map(|setup| {
|
|
416
|
+
(
|
|
417
|
+
setup.key.far,
|
|
418
|
+
setup.key.slot,
|
|
419
|
+
setup.name.as_deref(),
|
|
420
|
+
setup.size,
|
|
421
|
+
)
|
|
422
|
+
})
|
|
423
|
+
.collect();
|
|
424
|
+
assert_eq!(
|
|
425
|
+
summary,
|
|
426
|
+
vec![
|
|
427
|
+
(false, 0, Some("score"), Some(0.3)),
|
|
428
|
+
(false, 1, None, Some(0.05)),
|
|
429
|
+
(false, 2, Some("other"), Some(0.1)),
|
|
430
|
+
(true, 0, None, None),
|
|
431
|
+
]
|
|
432
|
+
);
|
|
433
|
+
assert_eq!(
|
|
434
|
+
bands,
|
|
435
|
+
vec![None, Some(0), Some(3), Some(1), Some(0), Some(2), Some(0)]
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
#[test]
|
|
440
|
+
fn a_margin_size_does_not_size_a_ggside_band() {
|
|
441
|
+
let sides = [
|
|
442
|
+
side(true, true, BandStyle::Marginal, Some(0.4)),
|
|
443
|
+
side(true, true, BandStyle::Ggside, None),
|
|
444
|
+
];
|
|
445
|
+
let (setups, _) = band_setups(&sides);
|
|
446
|
+
assert_eq!(setups[0].style, BandStyle::Ggside);
|
|
447
|
+
assert_eq!(setups[0].size, None);
|
|
346
448
|
}
|
|
347
449
|
|
|
348
450
|
#[test]
|
|
@@ -1038,8 +1038,17 @@ impl PreparedPlot {
|
|
|
1038
1038
|
layout: &'l PlotLayout,
|
|
1039
1039
|
band: usize,
|
|
1040
1040
|
) -> Option<&'l crate::layout::side_panel::BandLayout> {
|
|
1041
|
+
// Bands on one side are laid out in band order: count the earlier ones.
|
|
1041
1042
|
let side = self.bands.get(band)?.setup.screen_side(self.flipped);
|
|
1042
|
-
|
|
1043
|
+
let before = self.bands[..band]
|
|
1044
|
+
.iter()
|
|
1045
|
+
.filter(|other| other.setup.screen_side(self.flipped) == side)
|
|
1046
|
+
.count();
|
|
1047
|
+
layout
|
|
1048
|
+
.bands
|
|
1049
|
+
.iter()
|
|
1050
|
+
.filter(|laid| laid.side == side)
|
|
1051
|
+
.nth(before)
|
|
1043
1052
|
}
|
|
1044
1053
|
|
|
1045
1054
|
/// The data aesthetic drawn along a screen axis (`horizontal`: x), swapped
|
|
@@ -4661,7 +4670,14 @@ fn report_unimplemented(spec: &PlotSpec, warnings: &mut Vec<String>) {
|
|
|
4661
4670
|
|| ScaleKey::parse_guide_key(key).is_some_and(|scale| {
|
|
4662
4671
|
default_mapper(scale.aesthetic).is_some() && group_exists(scale)
|
|
4663
4672
|
});
|
|
4664
|
-
let
|
|
4673
|
+
let is_axis_mark = matches!(key.as_str(), "x" | "y")
|
|
4674
|
+
&& match guide {
|
|
4675
|
+
GuideSpec::Name(name) => name == "axis_mark",
|
|
4676
|
+
GuideSpec::Full(options) => options.name.as_deref() == Some("axis_mark"),
|
|
4677
|
+
};
|
|
4678
|
+
let built = is_axis_title_only(key, guide)
|
|
4679
|
+
|| is_axis_mark
|
|
4680
|
+
|| (is_style && guide.is_built_style_guide());
|
|
4665
4681
|
if !built {
|
|
4666
4682
|
warnings.push(format!(
|
|
4667
4683
|
"at 'guides.{key}': this guide option is not supported yet; ignored"
|
|
@@ -44,6 +44,9 @@ pub enum LabelArrangement {
|
|
|
44
44
|
Vertical,
|
|
45
45
|
/// The theme's angle, hjust and vjust ([`super::rotated`]).
|
|
46
46
|
Rotated,
|
|
47
|
+
/// `guide_axis_mark()`: labels spread along the axis with links to their
|
|
48
|
+
/// breaks (any side; horizontal axes turn the labels to read up).
|
|
49
|
+
Mark(super::axis_mark::AxisMark),
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/// Breaks of one axis with their labels.
|
|
@@ -53,7 +56,7 @@ pub struct AxisBreaks {
|
|
|
53
56
|
pub values: Vec<f64>,
|
|
54
57
|
/// Formatted labels, one per value.
|
|
55
58
|
pub labels: Vec<Label>,
|
|
56
|
-
/// Label placement (horizontal axes; vertical axes are
|
|
59
|
+
/// Label placement (horizontal axes; vertical axes are simple or [`LabelArrangement::Mark`]).
|
|
57
60
|
pub arrangement: LabelArrangement,
|
|
58
61
|
/// The break count asked of the scale (0 for fixed breaks): the HTML
|
|
59
62
|
/// runtime asks the same of a zoomed domain.
|
|
@@ -112,6 +115,10 @@ pub fn choose_breaks(
|
|
|
112
115
|
// lets-plot fixed breaks: every category (or given break) is a break.
|
|
113
116
|
let breaks = scale.breaks(0);
|
|
114
117
|
let mut breaks = AxisBreaks::new(breaks.positions, breaks.labels);
|
|
118
|
+
if let Some(mark) = scale.mark() {
|
|
119
|
+
breaks.arrangement = LabelArrangement::Mark(mark);
|
|
120
|
+
return breaks;
|
|
121
|
+
}
|
|
115
122
|
if orientation == Orientation::Horizontal && text.is_some() {
|
|
116
123
|
if rotation.is_some() {
|
|
117
124
|
breaks.arrangement = LabelArrangement::Rotated;
|
|
@@ -144,6 +151,12 @@ pub fn choose_breaks(
|
|
|
144
151
|
let count_for = |label_extent: f64| {
|
|
145
152
|
((axis_length / (label_extent + LABEL_DISTANCE_FOR_COUNT)).floor() as usize).max(1)
|
|
146
153
|
};
|
|
154
|
+
// Marked labels are spread, never dropped: one label line per break slot.
|
|
155
|
+
if let Some(mark) = scale.mark() {
|
|
156
|
+
let mut breaks = flex_breaks(&breaks_for, count_for(size));
|
|
157
|
+
breaks.arrangement = LabelArrangement::Mark(mark);
|
|
158
|
+
return breaks;
|
|
159
|
+
}
|
|
147
160
|
// lets-plot: an unrotated y label is font-size tall and never re-checked.
|
|
148
161
|
if orientation == Orientation::Vertical && rotation.is_none() {
|
|
149
162
|
return flex_breaks(&breaks_for, count_for(size));
|