pub struct ScatterPolar { /* private fields */ }Expand description
A structure representing a scatter polar plot.
The ScatterPolar struct facilitates the creation and customization of polar scatter plots with various options
for data selection, grouping, layout configuration, and aesthetic adjustments. It supports grouping of data,
customization of marker shapes, colors, sizes, line styles, and comprehensive layout customization
including titles and legends.
§Backend Support
| Backend | Supported |
|---|---|
| Plotly | Yes |
| Plotters | – |
§Arguments
data- A reference to theDataFramecontaining the data to be plotted.theta- A string slice specifying the column name to be used for the angular coordinates (in degrees).r- A string slice specifying the column name to be used for the radial coordinates.group- An optional string slice specifying the column name to be used for grouping data points.sort_groups_by- Optional comparatorfn(&str, &str) -> std::cmp::Orderingto control group ordering. Groups are sorted lexically by default.facet- An optional string slice specifying the column name to be used for faceting (creating multiple subplots).facet_config- An optional reference to aFacetConfigstruct for customizing facet behavior (grid dimensions, scales, gaps, etc.).mode- An optionalModespecifying the drawing mode (lines, markers, or both). Defaults to markers.opacity- An optionalf64value specifying the opacity of the plot elements (range: 0.0 to 1.0).fill- An optionalFilltype specifying how to fill the area under the trace.size- An optionalusizespecifying the size of the markers.color- An optionalRgbvalue specifying the color of the markers. This is used whengroupis not specified.colors- An optional vector ofRgbvalues specifying the colors for the markers. This is used whengroupis specified to differentiate between groups.shape- An optionalShapespecifying the shape of the markers. This is used whengroupis not specified.shapes- An optional vector ofShapevalues specifying multiple shapes for the markers when plotting multiple groups.width- An optionalf64specifying the width of the lines.line- An optionalLineStylespecifying the style of the line (e.g., solid, dashed).lines- An optional vector ofLineStyleenums specifying the styles of lines for multiple traces.plot_title- An optionalTextstruct specifying the title of the plot.legend_title- An optionalTextstruct specifying the title of the legend.legend- An optional reference to aLegendstruct for customizing the legend of the plot (e.g., positioning, font, etc.).
§Example
use plotlars::{Legend, Line, Mode, Plot, Rgb, ScatterPolar, Shape, Text};
use polars::prelude::*;
let dataset = LazyCsvReader::new(PlRefPath::new("data/product_comparison_polar.csv"))
.finish()
.unwrap()
.collect()
.unwrap();
ScatterPolar::builder()
.data(&dataset)
.theta("angle")
.r("score")
.group("product")
.mode(Mode::LinesMarkers)
.colors(vec![
Rgb(255, 99, 71),
Rgb(60, 179, 113),
])
.shapes(vec![
Shape::Circle,
Shape::Square,
])
.lines(vec![
Line::Solid,
Line::Dash,
])
.width(2.5)
.size(8)
.plot_title(
Text::from("Scatter Polar Plot")
.font("Arial")
.size(24)
)
.legend_title(
Text::from("Products")
.font("Arial")
.size(14)
)
.legend(
&Legend::new()
.x(0.85)
.y(0.95)
)
.build()
.plot();
Implementations§
Source§impl ScatterPolar
impl ScatterPolar
pub fn builder<'f1, 'f2, 'f3, 'f4, 'f5, 'f6, 'f7>() -> ScatterPolarBuilder<'f1, 'f2, 'f3, 'f4, 'f5, 'f6, 'f7>
Source§impl ScatterPolar
impl ScatterPolar
pub fn try_new( data: &DataFrame, theta: &str, r: &str, group: Option<&str>, sort_groups_by: Option<fn(&str, &str) -> Ordering>, facet: Option<&str>, facet_config: Option<&FacetConfig>, mode: Option<Mode>, opacity: Option<f64>, fill: Option<Fill>, size: Option<usize>, color: Option<Rgb>, colors: Option<Vec<Rgb>>, shape: Option<Shape>, shapes: Option<Vec<Shape>>, width: Option<f64>, line: Option<LineStyle>, lines: Option<Vec<LineStyle>>, plot_title: Option<Text>, legend_title: Option<Text>, legend: Option<&Legend>, ) -> Result<Self, PlotlarsError>
pub fn try_builder<'f1, 'f2, 'f3, 'f4, 'f5, 'f6, 'f7>() -> ScatterPolarTryBuilder<'f1, 'f2, 'f3, 'f4, 'f5, 'f6, 'f7>
Trait Implementations§
Source§impl Clone for ScatterPolar
impl Clone for ScatterPolar
Source§fn clone(&self) -> ScatterPolar
fn clone(&self) -> ScatterPolar
Returns a duplicate 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 ScatterPolar
impl RefUnwindSafe for ScatterPolar
impl Send for ScatterPolar
impl Sync for ScatterPolar
impl Unpin for ScatterPolar
impl UnsafeUnpin for ScatterPolar
impl UnwindSafe for ScatterPolar
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