Skip to content

Commit f3d1299

Browse files
jqnatividadclaude
andauthored
feat: add ScatterMap trace for the MapLibre map subplot (#417)
Add `ScatterMap`, the MapLibre-based counterpart to `ScatterMapbox`, drawn on the `layout.map` subplot (`LayoutMap`/`MapStyle`). It mirrors`ScatterMapbox` field-for-field - markers/lines, `Fill`/`Selection`, and the full hover set (text/hovertext/hoverinfo/hovertemplate/customdata/hoverlabel), but emits `"type": "scattermap"` and references `layout.map`. Add a `PlotType::ScatterMap` variant, re-export `ScatterMap` and the `scatter_map` module, and add a `serialize_scatter_map` unit test plus a doc example. Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 45e613d commit f3d1299

5 files changed

Lines changed: 405 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1212
- [[#410](https://github.com/plotly/plotly.rs/pull/410)] Add `LayoutGeo` options: `fitbounds` (`GeoFitBounds`), `resolution` (`GeoResolution`, 1:110M/1:50M base-layer detail), and `bgcolor`
1313
- [[#412](https://github.com/plotly/plotly.rs/pull/412)] Add `Violin` trace type with box, mean line, KDE span, and split/grouped support
1414
- [[#414](https://github.com/plotly/plotly.rs/issues/414)] Add `DensityMap` (MapLibre `map` subplot) trace type — density heatmaps with full color-scale and hover support
15+
- [[#417](https://github.com/plotly/plotly.rs/issues/417)] Add `ScatterMap` (MapLibre `map` subplot) trace type — the modern counterpart to `ScatterMapbox`
1516

1617
### Changed
1718

‎plotly/src/common/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ pub enum PlotType {
212212
ScatterGL,
213213
Scatter3D,
214214
ScatterMapbox,
215+
ScatterMap,
215216
ScatterGeo,
216217
ScatterPolar,
217218
ScatterPolarGL,

‎plotly/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ pub use plot::{Plot, Trace, Traces};
6161
// Also provide easy access to modules which contain additional trace-specific types
6262
pub use traces::{
6363
box_plot, choropleth, choropleth_map, contour, density_map, heat_map, histogram, image, mesh3d,
64-
sankey, scatter, scatter3d, scatter_mapbox, sunburst, surface, treemap, violin,
64+
sankey, scatter, scatter3d, scatter_map, scatter_mapbox, sunburst, surface, treemap, violin,
6565
};
6666
// Bring the different trace types into the top-level scope
6767
pub use traces::{
6868
Bar, BoxPlot, Candlestick, Choropleth, ChoroplethMap, Contour, DensityMap, DensityMapbox,
6969
HeatMap, Histogram, Image, Mesh3D, Ohlc, Pie, Sankey, Scatter, Scatter3D, ScatterGeo,
70-
ScatterMapbox, ScatterPolar, Sunburst, Surface, Table, Treemap, Violin,
70+
ScatterMap, ScatterMapbox, ScatterPolar, Sunburst, Surface, Table, Treemap, Violin,
7171
};
7272

7373
pub trait Restyle: serde::Serialize {}

‎plotly/src/traces/mod.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub mod sankey;
1818
pub mod scatter;
1919
pub mod scatter3d;
2020
pub mod scatter_geo;
21+
pub mod scatter_map;
2122
pub mod scatter_mapbox;
2223
mod scatter_polar;
2324
pub mod sunburst;
@@ -43,6 +44,7 @@ pub use sankey::Sankey;
4344
pub use scatter::Scatter;
4445
pub use scatter3d::Scatter3D;
4546
pub use scatter_geo::ScatterGeo;
47+
pub use scatter_map::ScatterMap;
4648
pub use scatter_mapbox::ScatterMapbox;
4749
pub use scatter_polar::ScatterPolar;
4850
pub use sunburst::Sunburst;

0 commit comments

Comments
 (0)