pub struct PieChart { /* private fields */ }
Expand description
A structure representing a pie chart.
The PieChart
struct allows for the creation and customization of pie charts, supporting
features such as labels, hole size for donut-style charts, slice pulling, rotation, and customizable plot titles.
It is ideal for visualizing proportions and distributions in categorical data.
§Arguments
data
- A reference to theDataFrame
containing the data to be plotted.labels
- A string slice specifying the column name to be used for slice labels.hole
- An optionalf64
value specifying the size of the hole in the center of the pie chart. A value of0.0
creates a full pie chart, while a value closer to1.0
creates a thinner ring.pull
- An optionalf64
value specifying the fraction by which each slice should be pulled out from the center.rotation
- An optionalf64
value specifying the starting angle (in degrees) of the first slice.plot_title
- An optionalText
struct specifying the title of the plot.
§Example
§Basic Pie Chart with Customization
use plotlars::{PieChart, Plot, Text};
let dataset = LazyCsvReader::new("data/penguins.csv")
.finish()
.unwrap()
.select([
col("species"),
])
.collect()
.unwrap();
PieChart::builder()
.data(&dataset)
.labels("species")
.hole(0.4)
.pull(0.01)
.rotation(20.0)
.plot_title(
Text::from("Pie Chart")
.font("Arial")
.size(18)
)
.build()
.plot();
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PieChart
impl !RefUnwindSafe for PieChart
impl !Send for PieChart
impl !Sync for PieChart
impl Unpin for PieChart
impl !UnwindSafe for PieChart
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