pub struct PolarArtist {
pub theta: Vec<f64>,
pub r: Vec<f64>,
pub color: Color,
pub label: Option<String>,
pub alpha: f64,
pub linewidth: f64,
pub filled: bool,
pub marker: Option<Marker>,
}Expand description
A polar line or filled radar chart in polar coordinates.
Each data point is defined by an angle theta (in radians) and a radial
distance r. In line mode, a polyline connects the data points. In filled
mode, the path is closed and the interior is filled, producing a radar or
area chart.
The rendering pipeline converts polar coordinates to Cartesian pixel
coordinates using x = cx + r*cos(theta), y = cy - r*sin(theta), draws
concentric circles for the r-grid, and radial lines for the theta-grid.
Fields§
§theta: Vec<f64>Angles in radians, measured counter-clockwise from the positive x-axis.
r: Vec<f64>Radial distances from the origin. Must have the same length as theta.
color: ColorStroke/fill color.
label: Option<String>Optional legend label.
alpha: f64Opacity from 0.0 (fully transparent) to 1.0 (fully opaque).
linewidth: f64Stroke width in pixels for the polar line.
filled: boolWhen true, the polar path is closed and filled (radar/area chart).
marker: Option<Marker>Optional marker shape drawn at each data point.
Implementations§
Source§impl PolarArtist
impl PolarArtist
Sourcepub fn color(&mut self, color: Color) -> &mut Self
pub fn color(&mut self, color: Color) -> &mut Self
Sets the line/fill color.
Accepts any Color value.
Sourcepub fn label(&mut self, label: &str) -> &mut Self
pub fn label(&mut self, label: &str) -> &mut Self
Sets the legend label for this polar series.
When a label is set, this series will appear in the legend if one is displayed on the axes.
Sourcepub fn alpha(&mut self, alpha: f64) -> &mut Self
pub fn alpha(&mut self, alpha: f64) -> &mut Self
Sets the opacity (0.0 = fully transparent, 1.0 = fully opaque).
The value is clamped to the [0.0, 1.0] range.
Sourcepub fn linewidth(&mut self, width: f64) -> &mut Self
pub fn linewidth(&mut self, width: f64) -> &mut Self
Sets the stroke width in pixels for the polar line.
A width of 1.5 is the default. Values below 1.0 may produce
sub-pixel rendering depending on the backend.
Sourcepub fn filled(&mut self, filled: bool) -> &mut Self
pub fn filled(&mut self, filled: bool) -> &mut Self
Controls whether the polar path is closed and filled.
When true, the path is closed (connecting the last point back to
the first) and the interior is filled with the configured color and
alpha. When false (default for polar_plot), only the line is drawn.
Sourcepub fn marker(&mut self, marker: Marker) -> &mut Self
pub fn marker(&mut self, marker: Marker) -> &mut Self
Sets the marker shape drawn at each data point.
By default, no markers are drawn (None). Set to Some(Marker::Circle)
or another variant to show markers at each vertex.
Sourcepub fn data_bounds(&self) -> (f64, f64, f64, f64)
pub fn data_bounds(&self) -> (f64, f64, f64, f64)
Computes the data-space bounding box (xmin, xmax, ymin, ymax) in
Cartesian coordinates derived from the polar data.
The polar data is converted to Cartesian coordinates (x = rcos(theta),
y = rsin(theta)) and the bounding box of those points is returned.
Falls back to (-1.0, 1.0, -1.0, 1.0) when no finite data exists.
Sourcepub fn max_finite_r(&self) -> f64
pub fn max_finite_r(&self) -> f64
Returns the maximum finite, positive radial value.
Returns 0.0 if no finite positive values exist.
Sourcepub fn polar_to_cartesian(r: f64, theta: f64) -> (f64, f64)
pub fn polar_to_cartesian(r: f64, theta: f64) -> (f64, f64)
Converts polar coordinates (r, theta) to Cartesian coordinates (x, y).
The angle theta is in radians, measured counter-clockwise from the
positive x-axis (3 o’clock position).
Sourcepub fn cartesian_points(&self) -> Vec<(f64, f64)>
pub fn cartesian_points(&self) -> Vec<(f64, f64)>
Returns an iterator of (x, y) Cartesian points derived from the polar data.
Non-finite r or theta values are filtered out.
Trait Implementations§
Source§impl Clone for PolarArtist
impl Clone for PolarArtist
Source§fn clone(&self) -> PolarArtist
fn clone(&self) -> PolarArtist
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more