pub struct Text { /* private fields */ }Expand description
A structure representing text with customizable content, font, size, and color.
§Example
use plotlars::{Axis, BarPlot, Plot, Text, Rgb};
let label = vec![""];
let value = vec![0];
let dataset = DataFrame::new(vec![
Series::new("label".into(), label),
Series::new("value".into(), value),
]).unwrap();
let axis = Axis::new()
.tick_values(vec![]);
BarPlot::builder()
.data(&dataset)
.labels("label")
.values("value")
.plot_title(
Text::from("Title")
.x(0.1)
.color(Rgb(178, 34, 34))
.size(30)
.font("Zapfino")
)
.x_title(
Text::from("X")
.color(Rgb(65, 105, 225))
.size(20)
.font("Marker Felt")
)
.y_title(
Text::from("Y")
.color(Rgb(255, 140, 0))
.size(20)
.font("Arial Black")
)
.x_axis(&axis)
.y_axis(&axis)
.build()
.plot();
Implementations§
Source§impl Text
impl Text
Sourcepub fn from(content: impl Into<String>) -> Self
pub fn from(content: impl Into<String>) -> Self
Creates a new Text instance from the given content.
§Argument
content- A value that can be converted into aString, representing the textual content.
Sourcepub fn font(self, font: impl Into<String>) -> Self
pub fn font(self, font: impl Into<String>) -> Self
Sets the font of the text.
§Argument
font- A value that can be converted into aString, representing the font name.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().