contourplot/
contourplot.rs1use polars::prelude::*;
2
3use plotlars::{Coloring, ContourPlot, Palette, Plot, Text};
4
5fn main() {
6 let dataset = df!(
7 "x" => &[0.0, 0.0, 0.0, 2.5, 2.5, 2.5, 5.0, 5.0, 5.0],
8 "y" => &[0.0, 7.5, 15.0, 0.0, 7.5, 15.0, 0.0, 7.5, 15.0],
9 "z" => &[0.0, 5.0, 10.0, 5.0, 2.5, 5.0, 10.0, 0.0, 0.0],
10 )
11 .unwrap();
12
13 ContourPlot::builder()
14 .data(&dataset)
15 .x("x")
16 .y("y")
17 .z("z")
18 .color_scale(Palette::Viridis)
19 .reverse_scale(true)
20 .coloring(Coloring::Fill)
21 .show_lines(false)
22 .plot_title(Text::from("Contour Plot").font("Arial").size(18))
23 .build()
24 .plot();
25}