Struct plotpy::Surface [−][src]
pub struct Surface { /* fields omitted */ }
Expand description
Generates a 3D a surface (or wireframe, or both)
Example
// import
use plotpy::{Surface, Plot};
use russell_lab::generate3d;
use std::path::Path;
// directory to save figures
const OUT_DIR: &str = "/tmp/plotpy/doc_tests";
// generate (x,y,z) matrices
let n = 21;
let (x, y, z) = generate3d(-2.0, 2.0, -2.0, 2.0, n, n, |x, y| x * x - y * y);
// configure and draw surface + wireframe
let mut surface = Surface::new();
surface.set_colormap_name("seismic")
.set_with_colorbar(true)
.set_with_wireframe(true)
.set_line_width(0.3);
// draw surface + wireframe
surface.draw(&x, &y, &z);
// add surface to plot
let mut plot = Plot::new();
plot.add(&surface)
.set_title("horse saddle equation") // must be after add surface
.set_camera(20.0, 35.0); // must be after add surface
// save figure
let path = Path::new(OUT_DIR).join("doc_surface.svg");
plot.save(&path)?;
Implementations
Sets the row stride
Sets the column stride
Sets option to generate surface
Sets option to generate wireframe
Sets the colormap index
Options:
- 0 – bwr
- 1 – RdBu
- 2 – hsv
- 3 – jet
- 4 – terrain
- 5 – pink
- 6 – Greys
>
6 – starts over from 0
Sets the colormap name
Options:
bwr
RdBu
hsv
jet
terrain
pink
Greys
- see more here https://matplotlib.org/stable/tutorials/colors/colormaps.html
Sets option to draw a colorbar
Sets the colorbar label
Sets the number format for the labels in the colorbar (cb)
Sets the color of wireframe lines
Sets the style of wireframe line
Options:
- “
-
”, “:
”, “--
”, “-.
”
Sets the width of wireframe line