pub struct ContourPlot { /* private fields */ }
Expand description
A structure representing a contour plot.
The ContourPlot
struct enables the creation of contour visualizations that display level
curves of a three‑dimensional surface on a two‑dimensional plane. It offers extensive
configuration options for contour styling, color scaling, axis appearance, legends, and
annotations. Users can fine‑tune the contour interval, choose from predefined color palettes,
reverse or hide the color scale, and set custom titles for both the plot and its axes in
order to improve the readability of complex surfaces.
§Arguments
data
- A reference to theDataFrame
containing the data to be plotted.x
- A string slice specifying the column name for x‑axis values.y
- A string slice specifying the column name for y‑axis values.z
- A string slice specifying the column name for z‑axis values whose magnitude determines each contour line.color_bar
- An optional reference to aColorBar
struct for customizing the color bar appearance.color_scale
- An optionalPalette
enum for specifying the color palette (e.g.,Palette::Viridis
).reverse_scale
- An optional boolean to reverse the color scale direction.show_scale
- An optional boolean to display the color scale on the plot.contours
- An optional reference to aContours
struct for configuring the contour interval, size, and coloring.plot_title
- An optionalText
struct for setting the title of the plot.x_title
- An optionalText
struct for labeling the x‑axis.y_title
- An optionalText
struct for labeling the y‑axis.x_axis
- An optional reference to anAxis
struct for customizing x‑axis appearance.y_axis
- An optional reference to anAxis
struct for customizing y‑axis appearance.
§Example
use polars::prelude::*;
use plotlars::{Plot, Coloring, Contours, ContourPlot, Palette};
let dataset = df!(
"x" => &[0.0, 0.0, 0.0, 2.5, 2.5, 2.5, 5.0, 5.0, 5.0],
"y" => &[0.0, 7.5, 15.0, 0.0, 7.5, 15.0, 0.0, 7.5, 15.0],
"z" => &[0.0, 5.0, 10.0, 5.0, 2.5, 5.0, 10.0, 0.0, 0.0],
)
.unwrap();
ContourPlot::builder()
.data(&dataset)
.x("x")
.y("y")
.z("z")
.color_scale(Palette::Viridis)
.reverse_scale(true)
.coloring(Coloring::Fill)
.show_lines(false)
.plot_title(
Text::from("Contour Plot")
.font("Arial")
.size(18)
)
.build()
.plot();
Implementations§
Source§impl ContourPlot
impl ContourPlot
Trait Implementations§
Source§impl Clone for ContourPlot
impl Clone for ContourPlot
Source§fn clone(&self) -> ContourPlot
fn clone(&self) -> ContourPlot
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 ContourPlot
impl !RefUnwindSafe for ContourPlot
impl !Send for ContourPlot
impl !Sync for ContourPlot
impl Unpin for ContourPlot
impl !UnwindSafe for ContourPlot
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