pub struct ScatterMap { /* private fields */ }
Expand description
A structure representing a scatter plot on a map.
The ScatterMap
struct allows for visualizing geographical data points on an interactive map.
Each data point is defined by its latitude and longitude, with additional options for grouping,
coloring, size, opacity, and map configuration such as zoom level and center coordinates.
This struct is ideal for displaying spatial data distributions, such as city locations or geospatial datasets.
§Arguments
data
- A reference to theDataFrame
containing the data to be plotted.latitude
- A string slice specifying the column name containing latitude values.longitude
- A string slice specifying the column name containing longitude values.center
- An optional array[f64; 2]
specifying the initial center point of the map ([latitude, longitude]).zoom
- An optionalu8
specifying the initial zoom level of the map.group
- An optional string slice specifying the column name for grouping data points (e.g., by city or category).opacity
- An optionalf64
value between0.0
and1.0
specifying the opacity of the points.size
- An optionalusize
specifying the size of the scatter points.color
- An optionalRgb
value specifying the color of the points (if no grouping is applied).colors
- An optional vector ofRgb
values specifying colors for grouped points.shape
- An optionalShape
enum specifying the marker shape for the points.shapes
- An optional vector ofShape
enums specifying shapes for grouped points.plot_title
- An optionalText
struct specifying the title of the plot.legend_title
- An optionalText
struct specifying the title of the legend.legend
- An optional reference to aLegend
struct for customizing the legend (e.g., positioning, font, etc.).
§Example
§Basic Scatter Map Plot
use plotlars::{Plot, ScatterMap, Text};
let dataset = LazyCsvReader::new("data/cities.csv")
.finish()
.unwrap()
.collect()
.unwrap();
ScatterMap::builder()
.data(&dataset)
.latitude("latitude")
.longitude("longitude")
.center([48.856613, 2.352222])
.zoom(4)
.group("city")
.opacity(0.5)
.size(12)
.plot_title(
Text::from("Scatter Map")
.font("Arial")
.size(18)
)
.legend_title("cities")
.build()
.plot();
Implementations§
Source§impl ScatterMap
impl ScatterMap
Trait Implementations§
Source§impl Clone for ScatterMap
impl Clone for ScatterMap
Source§fn clone(&self) -> ScatterMap
fn clone(&self) -> ScatterMap
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ScatterMap
impl !RefUnwindSafe for ScatterMap
impl !Send for ScatterMap
impl !Sync for ScatterMap
impl Unpin for ScatterMap
impl !UnwindSafe for ScatterMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more