ggrust 0.3.0__tar.gz → 0.4.0__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.
Files changed (238) hide show
  1. {ggrust-0.3.0 → ggrust-0.4.0}/Cargo.lock +2 -2
  2. {ggrust-0.3.0 → ggrust-0.4.0}/Cargo.toml +1 -1
  3. {ggrust-0.3.0 → ggrust-0.4.0}/PKG-INFO +1 -1
  4. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/build.rs +23 -1
  5. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/lines.rs +17 -15
  6. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/mod.rs +2 -0
  7. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/text.rs +39 -9
  8. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/grid.rs +42 -16
  9. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/layout/colorbar.rs +292 -4
  10. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/layout/legend.rs +95 -16
  11. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/layout/mod.rs +89 -8
  12. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/layout/zoom.rs +4 -4
  13. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/render/html.rs +5 -1
  14. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/mod.rs +112 -12
  15. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/spec.rs +117 -3
  16. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/guide.rs +5 -1
  17. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/theme.rs +5 -0
  18. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/theme/mod.rs +134 -8
  19. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/theme/values.rs +39 -10
  20. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/_typing.py +3 -0
  21. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/guide.py +25 -2
  22. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/scale.py +30 -1
  23. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/scale_color.py +85 -1
  24. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/theme.py +50 -2
  25. {ggrust-0.3.0 → ggrust-0.4.0}/LICENSE +0 -0
  26. {ggrust-0.3.0 → ggrust-0.4.0}/README.md +0 -0
  27. {ggrust-0.3.0 → ggrust-0.4.0}/THIRD_PARTY_NOTICES.md +0 -0
  28. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/Cargo.toml +0 -0
  29. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/examples/compare_letsplot.rs +0 -0
  30. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/examples/render_points.rs +0 -0
  31. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/LiberationMono-Bold.ttf +0 -0
  32. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/LiberationMono-BoldItalic.ttf +0 -0
  33. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/LiberationMono-Italic.ttf +0 -0
  34. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/LiberationMono-Regular.ttf +0 -0
  35. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/LiberationSans-Bold.ttf +0 -0
  36. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/LiberationSans-BoldItalic.ttf +0 -0
  37. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/LiberationSans-Italic.ttf +0 -0
  38. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/LiberationSans-Regular.ttf +0 -0
  39. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/fonts/OFL.txt +0 -0
  40. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/coord/cartesian.rs +0 -0
  41. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/coord/fixed.rs +0 -0
  42. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/coord/flip.rs +0 -0
  43. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/coord/mod.rs +0 -0
  44. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/data/as_discrete.rs +0 -0
  45. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/data/column.rs +0 -0
  46. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/data/correlation.rs +0 -0
  47. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/data/group.rs +0 -0
  48. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/data/inline.rs +0 -0
  49. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/data/layer.rs +0 -0
  50. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/data/mod.rs +0 -0
  51. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/data/resolution.rs +0 -0
  52. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/error.rs +0 -0
  53. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/facet.rs +0 -0
  54. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/abline.rs +0 -0
  55. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/area.rs +0 -0
  56. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/area_ridges.rs +0 -0
  57. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/bar.rs +0 -0
  58. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/bin2d.rs +0 -0
  59. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/blank.rs +0 -0
  60. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/boxplot.rs +0 -0
  61. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/bracket.rs +0 -0
  62. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/contour.rs +0 -0
  63. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/curve.rs +0 -0
  64. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/hex.rs +0 -0
  65. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/hover.rs +0 -0
  66. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/image.rs +0 -0
  67. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/interval.rs +0 -0
  68. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/jitter.rs +0 -0
  69. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/path.rs +0 -0
  70. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/point.rs +0 -0
  71. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/polygon.rs +0 -0
  72. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/quantiles.rs +0 -0
  73. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/raster.rs +0 -0
  74. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/rect.rs +0 -0
  75. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/reference_line.rs +0 -0
  76. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/repel.rs +0 -0
  77. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/repel_layout.rs +0 -0
  78. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/segment.rs +0 -0
  79. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/sina.rs +0 -0
  80. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/size_unit.rs +0 -0
  81. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/smooth.rs +0 -0
  82. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/step.rs +0 -0
  83. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/tile.rs +0 -0
  84. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/geom/violin.rs +0 -0
  85. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/grid_share.rs +0 -0
  86. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/layout/axis.rs +0 -0
  87. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/layout/facet.rs +0 -0
  88. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/layout/grid.rs +0 -0
  89. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/layout/rotated.rs +0 -0
  90. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/lib.rs +0 -0
  91. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/parallel.rs +0 -0
  92. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/parameters.rs +0 -0
  93. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/position/dodge.rs +0 -0
  94. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/position/identity.rs +0 -0
  95. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/position/jitter.rs +0 -0
  96. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/position/mod.rs +0 -0
  97. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/position/nudge.rs +0 -0
  98. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/position/random.rs +0 -0
  99. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/position/shift.rs +0 -0
  100. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/position/stack.rs +0 -0
  101. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/render/canvas.rs +0 -0
  102. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/render/mod.rs +0 -0
  103. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/render/pdf.rs +0 -0
  104. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/render/png.rs +0 -0
  105. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/render/sprite.rs +0 -0
  106. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/render/svg.rs +0 -0
  107. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/breaks.rs +0 -0
  108. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/continuous.rs +0 -0
  109. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/datetime.rs +0 -0
  110. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/discrete.rs +0 -0
  111. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/format.rs +0 -0
  112. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/label_pattern.rs +0 -0
  113. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/mod.rs +0 -0
  114. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/number_format.rs +0 -0
  115. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/position.rs +0 -0
  116. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/spec.rs +0 -0
  117. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/brewer.rs +0 -0
  118. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/brewer_data.rs +0 -0
  119. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/color.rs +0 -0
  120. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/color_space.rs +0 -0
  121. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/colormap.rs +0 -0
  122. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/colormap_data.rs +0 -0
  123. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/gradient.rs +0 -0
  124. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/hue.rs +0 -0
  125. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/identity.rs +0 -0
  126. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/linetype.rs +0 -0
  127. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/manual.rs +0 -0
  128. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/numeric.rs +0 -0
  129. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/style/shape.rs +0 -0
  130. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scale/transform.rs +0 -0
  131. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scene/color.rs +0 -0
  132. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scene/color_names.rs +0 -0
  133. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scene/encoded_png.rs +0 -0
  134. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scene/geometry.rs +0 -0
  135. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scene/marker.rs +0 -0
  136. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/scene/mod.rs +0 -0
  137. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/aesthetic.rs +0 -0
  138. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/coord.rs +0 -0
  139. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/facet.rs +0 -0
  140. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/frames.rs +0 -0
  141. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/layer.rs +0 -0
  142. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/mod.rs +0 -0
  143. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/plot.rs +0 -0
  144. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/scale.rs +0 -0
  145. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/spec/subplots.rs +0 -0
  146. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/bin.rs +0 -0
  147. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/bin2d.rs +0 -0
  148. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/binhex.rs +0 -0
  149. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/boxplot.rs +0 -0
  150. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/contour.rs +0 -0
  151. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/count.rs +0 -0
  152. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/density.rs +0 -0
  153. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/density2d.rs +0 -0
  154. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/density_1d.rs +0 -0
  155. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/densityridges.rs +0 -0
  156. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/ecdf.rs +0 -0
  157. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/groups.rs +0 -0
  158. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/identity.rs +0 -0
  159. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/mod.rs +0 -0
  160. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/sina.rs +0 -0
  161. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/smooth.rs +0 -0
  162. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/sum.rs +0 -0
  163. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/summary.rs +0 -0
  164. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/stat/ydensity.rs +0 -0
  165. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/style/mod.rs +0 -0
  166. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/suggest.rs +0 -0
  167. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/text/estimate.rs +0 -0
  168. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/text/mod.rs +0 -0
  169. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/tooltip/content.rs +0 -0
  170. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/tooltip/mod.rs +0 -0
  171. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/src/tooltip/template.rs +0 -0
  172. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/build_bracket.rs +0 -0
  173. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/build_lines.rs +0 -0
  174. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/build_point.rs +0 -0
  175. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/build_regressions.rs +0 -0
  176. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/build_text_halo.rs +0 -0
  177. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/data_columns.rs +0 -0
  178. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/number_format.json +0 -0
  179. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/discrete_ordering.json +0 -0
  180. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/distributions.json +0 -0
  181. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/dotplot.json +0 -0
  182. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/faceted.json +0 -0
  183. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/grid.json +0 -0
  184. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/heatmap.json +0 -0
  185. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/image.json +0 -0
  186. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/pandas_categorical.json +0 -0
  187. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/polars_enum.json +0 -0
  188. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/primitives.json +0 -0
  189. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/ridge.json +0 -0
  190. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/umap_categorical.json +0 -0
  191. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/umap_continuous.json +0 -0
  192. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/violin_box.json +0 -0
  193. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/void_theme.json +0 -0
  194. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/volcano.json +0 -0
  195. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/fixtures/specs/with_inline_data.json +0 -0
  196. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/golden/scene_showcase.svg +0 -0
  197. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/render_parity.rs +0 -0
  198. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/render_scene.rs +0 -0
  199. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/render_sprites.rs +0 -0
  200. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/spec_fixtures.rs +0 -0
  201. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-core/tests/spec_regressions.rs +0 -0
  202. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-python/Cargo.toml +0 -0
  203. {ggrust-0.3.0 → ggrust-0.4.0}/crates/ggrust-python/src/lib.rs +0 -0
  204. {ggrust-0.3.0 → ggrust-0.4.0}/js/ggrust.js +0 -0
  205. {ggrust-0.3.0 → ggrust-0.4.0}/pyproject.toml +0 -0
  206. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/__init__.py +0 -0
  207. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/_data.py +0 -0
  208. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/_ggrust.pyi +0 -0
  209. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/_lets_plot.py +0 -0
  210. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/_render.py +0 -0
  211. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/bistro/__init__.py +0 -0
  212. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/bistro/corr.py +0 -0
  213. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/errors.py +0 -0
  214. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/export.py +0 -0
  215. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/mapping.py +0 -0
  216. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/__init__.py +0 -0
  217. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/coord.py +0 -0
  218. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/core.py +0 -0
  219. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/expand_limits.py +0 -0
  220. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/facet.py +0 -0
  221. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/geom.py +0 -0
  222. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/geom_extras.py +0 -0
  223. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/geom_function.py +0 -0
  224. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/geom_imshow.py +0 -0
  225. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/gggrid.py +0 -0
  226. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/ggtb.py +0 -0
  227. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/label.py +0 -0
  228. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/plot.py +0 -0
  229. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/position.py +0 -0
  230. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/scale_identity.py +0 -0
  231. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/scale_shape.py +0 -0
  232. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/scale_size.py +0 -0
  233. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/series_meta.py +0 -0
  234. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/stat.py +0 -0
  235. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/subplots.py +0 -0
  236. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/tooltip.py +0 -0
  237. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/plot/util.py +0 -0
  238. {ggrust-0.3.0 → ggrust-0.4.0}/python/ggrust/py.typed +0 -0
@@ -448,7 +448,7 @@ dependencies = [
448
448
 
449
449
  [[package]]
450
450
  name = "ggrust-core"
451
- version = "0.3.0"
451
+ version = "0.4.0"
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.3.0"
476
+ version = "0.4.0"
477
477
  dependencies = [
478
478
  "ggrust-core",
479
479
  "pyo3",
@@ -3,7 +3,7 @@ resolver = "3"
3
3
  members = ["crates/ggrust-core", "crates/ggrust-python"]
4
4
 
5
5
  [workspace.package]
6
- version = "0.3.0"
6
+ version = "0.4.0"
7
7
  edition = "2024"
8
8
  license = "MIT"
9
9
  repository = "https://github.com/datavil/ggrust"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ggrust
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Topic :: Scientific/Engineering :: Visualization
@@ -3034,6 +3034,8 @@ fn train_style_scales(
3034
3034
  let spec = specs.get(&aesthetic).unwrap_or(&default_spec);
3035
3035
  let mapper = spec.mapper(aesthetic, warnings)?;
3036
3036
  let domain = spec.discrete_domain()?;
3037
+ // Fail early on a bad `oob`, also when the data turns out discrete.
3038
+ spec.oob()?;
3037
3039
  let scale = if discrete.contains(&aesthetic) {
3038
3040
  StyleScale::discrete(mapper, domain)
3039
3041
  } else {
@@ -3124,6 +3126,7 @@ fn assemble_legends(
3124
3126
  colors,
3125
3127
  bar_width: options.bar_width,
3126
3128
  bar_height: options.bar_height,
3129
+ label_ends: options.label_ends,
3127
3130
  };
3128
3131
  // lets-plot: an equal colorbar under the same title is shown once; a
3129
3132
  // different one gets "title (aesthetic)", which replaces an earlier
@@ -3271,6 +3274,7 @@ fn same_colorbar(left: &Colorbar, right: &Colorbar) -> bool {
3271
3274
  && left.colors == right.colors
3272
3275
  && left.bar_width == right.bar_width
3273
3276
  && left.bar_height == right.bar_height
3277
+ && left.label_ends == right.label_ends
3274
3278
  }
3275
3279
 
3276
3280
  /// lets-plot has no limit; this keeps a typo from allocating billions of segments.
@@ -3281,6 +3285,8 @@ struct ColorbarOptions {
3281
3285
  bins: usize,
3282
3286
  bar_width: Option<f64>,
3283
3287
  bar_height: Option<f64>,
3288
+ /// `label_position="ends"`.
3289
+ label_ends: bool,
3284
3290
  }
3285
3291
 
3286
3292
  /// The guides of one aesthetic: `guides(...)` first, then the scale's own `guide`.
@@ -3401,7 +3407,7 @@ impl<'a> Guides<'a> {
3401
3407
  Ok(parsed)
3402
3408
  }
3403
3409
 
3404
- /// `guide_colorbar(barwidth, barheight, nbin)`, validated. As lets-plot
3410
+ /// `guide_colorbar(barwidth, barheight, nbin, label_position)`, validated. As lets-plot
3405
3411
  /// (`GuideOptionsList.getColorBarOptions`), one colorbar guide gives all of them:
3406
3412
  /// `guides()` over the scale's own guide, never mixed.
3407
3413
  fn colorbar_options(&self, aesthetic: Aesthetic) -> Result<ColorbarOptions> {
@@ -3413,6 +3419,7 @@ impl<'a> Guides<'a> {
3413
3419
  bins: DEFAULT_BINS,
3414
3420
  bar_width: None,
3415
3421
  bar_height: None,
3422
+ label_ends: false,
3416
3423
  });
3417
3424
  };
3418
3425
  let size = |value: Option<f64>, key: &str| -> Result<Option<f64>> {
@@ -3438,10 +3445,25 @@ impl<'a> Guides<'a> {
3438
3445
  ));
3439
3446
  }
3440
3447
  };
3448
+ let label_ends = match options.label_position.as_deref() {
3449
+ None => false,
3450
+ Some("ends") => true,
3451
+ Some(other) => {
3452
+ return Err(Error::spec(
3453
+ format!("{path}.label_position"),
3454
+ format!(
3455
+ "unknown colorbar label_position '{other}'; expected 'ends' \
3456
+ (or leave it unset for labels along the bar){}",
3457
+ crate::suggest::did_you_mean(other, ["ends"])
3458
+ ),
3459
+ ));
3460
+ }
3461
+ };
3441
3462
  Ok(ColorbarOptions {
3442
3463
  bins,
3443
3464
  bar_width: size(options.barwidth, "barwidth")?,
3444
3465
  bar_height: size(options.barheight, "barheight")?,
3466
+ label_ends,
3445
3467
  })
3446
3468
  }
3447
3469
  }
@@ -112,9 +112,9 @@ pub(super) fn styled_paths(points: &[(f64, f64)], strokes: &[Option<Stroke>]) ->
112
112
  paths
113
113
  }
114
114
 
115
- /// lets-plot `arrow()` options.
115
+ /// lets-plot `arrow()` options (geom lines; theme axis lines, see `theme::AxisLine`).
116
116
  #[derive(Debug, Clone, Copy, PartialEq)]
117
- pub(super) struct Arrow {
117
+ pub struct Arrow {
118
118
  angle: f64,
119
119
  length: f64,
120
120
  first: bool,
@@ -128,43 +128,45 @@ impl Arrow {
128
128
  let Some(value) = parameters.value("arrow") else {
129
129
  return Ok(None);
130
130
  };
131
- let path = parameters.path_of("arrow");
132
- let fail = |message: String| Error::spec(&path, message);
131
+ Arrow::from_value(value)
132
+ .map(Some)
133
+ .map_err(|message| Error::spec(parameters.path_of("arrow"), message))
134
+ }
135
+
136
+ /// An `arrow(angle, length, ends, type)` object; the error message names the
137
+ /// bad field and what it accepts.
138
+ pub(crate) fn from_value(value: &Value) -> std::result::Result<Arrow, String> {
133
139
  let Value::Object(fields) = value else {
134
- return Err(fail(format!("expected arrow(), got {value}")));
140
+ return Err(format!("expected arrow(), got {value}"));
135
141
  };
136
142
  let number = |name: &str, default: f64| match fields.get(name) {
137
143
  None | Some(Value::Null) => Ok(default),
138
144
  Some(value) => value
139
145
  .as_f64()
140
146
  .filter(|number| number.is_finite() && *number >= 0.0)
141
- .ok_or_else(|| {
142
- fail(format!(
143
- "{name}: expected a non-negative number, got {value}"
144
- ))
145
- }),
147
+ .ok_or_else(|| format!("{name}: expected a non-negative number, got {value}")),
146
148
  };
147
149
  let text = |name: &str, default: &str, accepted: &[&str]| match fields.get(name) {
148
150
  None | Some(Value::Null) => Ok(default.to_owned()),
149
151
  Some(Value::String(text)) if accepted.contains(&text.as_str()) => Ok(text.clone()),
150
- Some(value) => Err(fail(format!(
152
+ Some(value) => Err(format!(
151
153
  "{name}: expected one of {}, got {value}",
152
154
  accepted.join(", ")
153
- ))),
155
+ )),
154
156
  };
155
157
  let ends = text("ends", "last", &["last", "first", "both"])?;
156
- Ok(Some(Arrow {
158
+ Ok(Arrow {
157
159
  angle: number("angle", 30.0)?,
158
160
  length: number("length", 10.0)?,
159
161
  first: ends != "last",
160
162
  last: ends != "first",
161
163
  closed: text("type", "open", &["open", "closed"])? == "closed",
162
- }))
164
+ })
163
165
  }
164
166
 
165
167
  /// Draw heads at the requested ends of `points` and pull those ends back by
166
168
  /// the line width so the line does not poke through the tip (as lets-plot).
167
- pub(super) fn apply(&self, points: &mut [(f64, f64)], stroke: &Stroke) -> Vec<Node> {
169
+ pub(crate) fn apply(&self, points: &mut [(f64, f64)], stroke: &Stroke) -> Vec<Node> {
168
170
  self.apply_at(points, stroke, true, true)
169
171
  }
170
172
 
@@ -21,6 +21,8 @@ mod image;
21
21
  mod interval;
22
22
  mod jitter;
23
23
  mod lines;
24
+
25
+ pub use lines::Arrow;
24
26
  mod path;
25
27
  mod point;
26
28
  mod polygon;
@@ -11,8 +11,9 @@
11
11
  //! else the plot background, else white) faded by `alpha`, under the text.
12
12
  //! `geom_label` has no halo (lets-plot).
13
13
  //!
14
+ //! Lines of a multi-line text are `lineheight` (1.0) x font size apart.
15
+ //!
14
16
  //! What it does not do (yet): `label_format`, `na_text`, `check_overlap`,
15
- //! `halo_*`, `lineheight` (lines are one font size apart), `size_unit`,
16
17
  //! `hjust`/`vjust` `inward`/`outward`.
17
18
  //!
18
19
  //! `size_unit="x"`/`"y"` scales the font by one axis unit / 6 px (lets-plot's
@@ -77,6 +78,7 @@ const TEXT_PARAMETERS: &[&str] = &[
77
78
  "size_unit",
78
79
  "halo_width",
79
80
  "halo_color",
81
+ "lineheight",
80
82
  ];
81
83
 
82
84
  const PARAMETERS: &[&str] = &[
@@ -86,6 +88,7 @@ const PARAMETERS: &[&str] = &[
86
88
  "label_r",
87
89
  "label_size",
88
90
  "size_unit",
91
+ "lineheight",
89
92
  ];
90
93
 
91
94
  /// lets-plot `TextGeom` `BASELINE_TEXT_WIDTH`: pixels per unit of `size` under `size_unit`.
@@ -205,6 +208,8 @@ pub(super) struct Look {
205
208
  alpha: f64,
206
209
  /// Layer halo `(color, stroke width px)`, see [`halo`]; faded by `alpha`.
207
210
  pub(super) halo: Option<(Color, f64)>,
211
+ /// Distance between line centres, in font sizes (`lineheight`).
212
+ pub(super) line_height: f64,
208
213
  }
209
214
 
210
215
  pub(super) fn look(styles: &Styles, row: usize, label: bool) -> Result<Look> {
@@ -232,6 +237,7 @@ pub(super) fn look(styles: &Styles, row: usize, label: bool) -> Result<Look> {
232
237
  },
233
238
  alpha,
234
239
  halo: None,
240
+ line_height: 1.0,
235
241
  })
236
242
  }
237
243
 
@@ -249,6 +255,21 @@ pub(super) fn halo(layer: &DrawLayer) -> Result<Option<(Color, f64)>> {
249
255
  Ok(Some((color, 2.0 * width)))
250
256
  }
251
257
 
258
+ /// `lineheight=...`: a finite, non-negative multiple of the font size (1.0).
259
+ fn line_height(layer: &DrawLayer) -> Result<f64> {
260
+ match layer.parameters.number("lineheight")? {
261
+ None => Ok(1.0),
262
+ Some(value) if value.is_finite() && value >= 0.0 => Ok(value),
263
+ Some(value) => Err(crate::Error::spec(
264
+ layer.parameters.path_of("lineheight"),
265
+ format!(
266
+ "lineheight must be a non-negative number of font sizes (1.0 is single \
267
+ spacing), got {value}"
268
+ ),
269
+ )),
270
+ }
271
+ }
272
+
252
273
  pub(super) fn key_size(styles: &Styles) -> Result<(f64, f64)> {
253
274
  let size = styles.numbers(Aesthetic::Size)?.get(0).max(0.0) * TEXT_UNIT_SIZE;
254
275
  Ok((size, size))
@@ -290,6 +311,7 @@ fn draw_texts(layer: &DrawLayer, panel: &Panel, label: bool) -> Result<Vec<Node>
290
311
  .number("label_size")?
291
312
  .unwrap_or(LABEL_BORDER);
292
313
  let halo = if label { None } else { halo(layer)? };
314
+ let line_height = line_height(layer)?;
293
315
  let ratio = size_unit_ratio(&layer.parameters, panel, SIZE_UNIT_TEXT_WIDTH)?;
294
316
  let mut nodes = Vec::new();
295
317
  for row in 0..layer.data.row_count() {
@@ -306,6 +328,7 @@ fn draw_texts(layer: &DrawLayer, panel: &Panel, label: bool) -> Result<Vec<Node>
306
328
  continue;
307
329
  }
308
330
  look.halo = halo;
331
+ look.line_height = line_height;
309
332
  // Anchored, so interactive zoom moves each text with its point.
310
333
  nodes.push(Node::Group(Group {
311
334
  clip: None,
@@ -318,7 +341,7 @@ fn draw_texts(layer: &DrawLayer, panel: &Panel, label: bool) -> Result<Vec<Node>
318
341
  }
319
342
 
320
343
  /// The text (and box) of one row, placed so that the point sits at (`hjust`,
321
- /// `vjust`) of the text block. Lines are one font size apart; `vjust` spans
344
+ /// `vjust`) of the text block. Lines are `line_height` font sizes apart; `vjust` spans
322
345
  /// 0.7 em of the block's height (lets-plot's baseline placement). A power of ten
323
346
  /// in the text (`·\(10^{8}\)`) is drawn as a superscript.
324
347
  pub(super) fn draw_one(
@@ -334,7 +357,9 @@ pub(super) fn draw_one(
334
357
  let line_count = lines.len() as f64;
335
358
  let (sin, cos) = look.angle.to_radians().sin_cos();
336
359
  // Offset of the block centre from the point, in the text's own frame (y down).
337
- let block_height = line_count * look.size;
360
+ let spacing = look.line_height * look.size;
361
+ // The block is one font size for the first line plus the spacing per extra line.
362
+ let block_height = look.size + (line_count - 1.0) * spacing;
338
363
  let pad = if label { padding * look.size } else { 0.0 };
339
364
  // A label is placed by its box (its top at the point for vjust = 1, as
340
365
  // lets-plot); plain text by its baselines.
@@ -347,8 +372,8 @@ pub(super) fn draw_one(
347
372
  (
348
373
  (0.5 - look.hjust) * width,
349
374
  (look.vjust - 0.5) * VJUST_SPAN * look.size
350
- - (1.0 - look.vjust) * (line_count - 1.0) * look.size
351
- + (line_count - 1.0) * look.size / 2.0,
375
+ - (1.0 - look.vjust) * (line_count - 1.0) * spacing
376
+ + (line_count - 1.0) * spacing / 2.0,
352
377
  )
353
378
  };
354
379
  let rotate =
@@ -371,8 +396,8 @@ pub(super) fn draw_one(
371
396
  }
372
397
  let mut texts = Vec::with_capacity(lines.len());
373
398
  for (index, (line, line_width)) in lines.into_iter().zip(widths).enumerate() {
374
- // Line centres, one font size apart, around the block centre.
375
- let line_offset = (index as f64 - (line_count - 1.0) / 2.0) * look.size;
399
+ // Line centres, `spacing` apart, around the block centre.
400
+ let line_offset = (index as f64 - (line_count - 1.0) / 2.0) * spacing;
376
401
  // Each line aligned within the block by hjust (left-aligned for 0).
377
402
  let line_shift = (look.hjust - 0.5) * (width - line_width);
378
403
  let (x, y) = rotate((centre_offset.0 + line_shift, centre_offset.1 + line_offset));
@@ -428,11 +453,16 @@ fn measured_lines(look: &Look) -> (Vec<Label>, Vec<f64>) {
428
453
  }
429
454
 
430
455
  /// Width and height of a text block as [`draw_one`] lays it out: the widest
431
- /// line, one font size per line (lets-plot `TextUtil.measure` at line height 1).
456
+ /// line, one font size for the first line plus `line_height` font sizes per extra
457
+ /// line (lets-plot `TextUtil.measure`).
432
458
  pub(super) fn block_size(look: &Look) -> (f64, f64) {
433
459
  let (lines, widths) = measured_lines(look);
434
460
  let width = widths.into_iter().fold(0.0, f64::max);
435
- (width, lines.len() as f64 * look.size)
461
+ let extra_lines = lines.len().saturating_sub(1) as f64;
462
+ (
463
+ width,
464
+ look.size + extra_lines * look.line_height * look.size,
465
+ )
436
466
  }
437
467
 
438
468
  /// Outline of a box centred on the origin with rounded corners.
@@ -19,7 +19,7 @@ use crate::layout::grid::{DEFAULT_SPACING, cell_rects, shrink_to_aspect};
19
19
  use crate::layout::zoom::Zoom;
20
20
  use crate::layout::{
21
21
  LegendBlock, LegendBox, Titles, draw_legends, heading_nodes, headings_band, legend_budget,
22
- measure_legends, shrink,
22
+ measure_themed_legends, shrink,
23
23
  };
24
24
  use crate::parallel;
25
25
  use crate::scene::{Color, Group, Node, PerItem, Rect, Rects, Scene};
@@ -141,11 +141,26 @@ struct Collected {
141
141
  position: LegendPosition,
142
142
  justification: (f64, f64),
143
143
  boxes: Vec<LegendBox>,
144
- /// The figure's theme: lets-plot builds legend boxes in their figure, so they keep
145
- /// its legend text, keys and spacing.
144
+ /// Per box, the theme of the figure it came from: lets-plot builds legend boxes
145
+ /// in their figure, so each keeps its legend text, keys and spacing. Once
146
+ /// grouped, these carry the group's arrangement too ([`arranged`]).
147
+ box_themes: Vec<Theme>,
148
+ /// The first figure's theme: it and the grid's theme arrange the group's block.
146
149
  theme: Theme,
147
150
  }
148
151
 
152
+ /// `theme` with the arrangement of a collected legend group: its placement, and
153
+ /// the grid's box layout and spacing (lets-plot `LegendsBlockInfo.arrangeLegendBoxes`).
154
+ fn arranged(theme: &Theme, group: &Collected, grid_theme: &Theme) -> Theme {
155
+ let mut theme = theme.clone();
156
+ theme.legend_position = group.position;
157
+ theme.legend_justification = group.justification;
158
+ theme.legend_box_horizontal = grid_theme.legend_box_horizontal;
159
+ theme.legend_box_just = grid_theme.legend_box_just;
160
+ theme.legend_spacing = grid_theme.legend_spacing;
161
+ theme
162
+ }
163
+
149
164
  /// What a grid's figures see of it while they are prepared.
150
165
  struct GridContext<'a> {
151
166
  frames: &'a [DataFrame],
@@ -336,11 +351,13 @@ impl<'s> PreparedGrid<'s> {
336
351
  | LegendPosition::Bottom
337
352
  );
338
353
  if collects && fixed && !plot.legends.is_empty() {
354
+ let boxes = std::mem::take(&mut plot.legends);
339
355
  collected.push(Collected {
340
356
  position: plot_theme.legend_position,
341
357
  justification: plot_theme.legend_justification,
358
+ box_themes: vec![plot_theme.clone(); boxes.len()],
342
359
  theme: plot_theme,
343
- boxes: std::mem::take(&mut plot.legends),
360
+ boxes,
344
361
  });
345
362
  }
346
363
  Some(Element::Plot(Box::new(plot)))
@@ -364,7 +381,7 @@ impl<'s> PreparedGrid<'s> {
364
381
  let (legend_groups, passed_up) = if collects && own_guides == Guides::Auto {
365
382
  (Vec::new(), collected)
366
383
  } else {
367
- (group_legends(collected), Vec::new())
384
+ (group_legends(collected, &theme), Vec::new())
368
385
  };
369
386
  let title = spec.ggtitle.as_ref();
370
387
  let titles = Titles {
@@ -552,14 +569,9 @@ impl<'s> PreparedGrid<'s> {
552
569
  ) -> Result<Vec<(&Collected, LegendBlock<'_>, Theme)>> {
553
570
  let mut blocks = Vec::new();
554
571
  for group in &self.legend_groups {
555
- // Boxes keep their figure's theme; the grid's theme arranges them
556
- // (lets-plot `LegendsBlockInfo.arrangeLegendBoxes`).
557
- let mut block_theme = group.theme.clone();
558
- block_theme.legend_position = group.position;
559
- block_theme.legend_justification = group.justification;
560
- block_theme.legend_box_horizontal = self.theme.legend_box_horizontal;
561
- block_theme.legend_box_just = self.theme.legend_box_just;
562
- block_theme.legend_spacing = self.theme.legend_spacing;
572
+ // Boxes keep their figure's theme (`box_themes`); the grid's theme
573
+ // arranges them (lets-plot `LegendsBlockInfo.arrangeLegendBoxes`).
574
+ let block_theme = arranged(&group.theme, group, &self.theme);
563
575
  // `area` is already inside the grid's margins.
564
576
  let budget = legend_budget(
565
577
  &Theme {
@@ -568,7 +580,12 @@ impl<'s> PreparedGrid<'s> {
568
580
  },
569
581
  area,
570
582
  );
571
- if let Some(block) = measure_legends(&group.boxes, &block_theme, Some(budget))? {
583
+ if let Some(block) = measure_themed_legends(
584
+ &group.boxes,
585
+ Some(&group.box_themes),
586
+ &block_theme,
587
+ Some(budget),
588
+ )? {
572
589
  blocks.push((group, block, block_theme));
573
590
  }
574
591
  }
@@ -684,7 +701,7 @@ fn legend_origin(inner: Rect, outer: Rect, size: (f64, f64), group: &Collected)
684
701
 
685
702
  /// Collected legends grouped by placement, in order of first appearance, each
686
703
  /// group without duplicates (lets-plot `LegendsBlockInfo.arrangeLegendBoxes`).
687
- fn group_legends(collected: Vec<Collected>) -> Vec<Collected> {
704
+ fn group_legends(collected: Vec<Collected>, grid_theme: &Theme) -> Vec<Collected> {
688
705
  let mut groups: Vec<Collected> = Vec::new();
689
706
  for item in collected {
690
707
  let index = match groups.iter().position(|group| {
@@ -694,22 +711,31 @@ fn group_legends(collected: Vec<Collected>) -> Vec<Collected> {
694
711
  None => {
695
712
  groups.push(Collected {
696
713
  boxes: Vec::new(),
714
+ box_themes: Vec::new(),
697
715
  ..item
698
716
  });
699
717
  groups.len() - 1
700
718
  }
701
719
  };
702
720
  let group = &mut groups[index];
703
- for legend_box in item.boxes {
721
+ for (legend_box, box_theme) in item.boxes.into_iter().zip(item.box_themes) {
704
722
  if !group
705
723
  .boxes
706
724
  .iter()
707
725
  .any(|kept| kept.same_content(&legend_box))
708
726
  {
709
727
  group.boxes.push(legend_box);
728
+ group.box_themes.push(box_theme);
710
729
  }
711
730
  }
712
731
  }
732
+ for group in &mut groups {
733
+ let themes = std::mem::take(&mut group.box_themes);
734
+ group.box_themes = themes
735
+ .iter()
736
+ .map(|theme| arranged(theme, group, grid_theme))
737
+ .collect();
738
+ }
713
739
  groups
714
740
  }
715
741