1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Rust plotting library using Python (Matplotlib)
//!
//! This library generates plots by calling **python3** after generating a python script.
//! The name of the python script is based on the name of the figure (png, svg, ...).
//! If an error occurs, a log file is created (also named as the figure).
//!
//! The main idea here is to create objects such as `Curve`, `Contour`, `Histogram`,
//! or `Surface` and add it to a plot using the `add` command. The plot may
//! also configured using the methods of `Plot`.
//!
//! Each object (e.g. `Curve`, `Legend`, `Text`) defines a number of configuration options
//! that can be directly set on the object. Then, the `draw` method of each object must
//! be called before adding to `Plot`.
//!
//! # Example
//!
//! ```
//! # use plotpy::{Plot, Surface};
//! # use std::path::Path;
//! # fn main() -> Result<(), &'static str> {
//! use russell_lab::generate3d;
//! let mut surface = Surface::new();
//! surface
//! .set_with_wireframe(true)
//! .set_colormap_name("Pastel1")
//! .set_with_colorbar(true)
//! .set_colorbar_label("temperature")
//! .set_line_color("#1862ab")
//! .set_line_style(":")
//! .set_line_width(0.75);
//!
//! // draw surface
//! let n = 9;
//! let (x, y, z) = generate3d(-2.0, 2.0, -2.0, 2.0, n, n, |x, y| x * x + y * y);
//! surface.draw(&x, &y, &z);
//!
//! // add surface to plot
//! let mut plot = Plot::new();
//! plot.add(&surface);
//!
//! // save figure
//! plot.save(Path::new("/tmp/plotpy/example_main.svg"))?;
//! # Ok(())
//! # }
//! ```
//!
//! 
//!
// modules ////////////////////////////////////////
pub use crate*;
pub use crate*;
pub use crate*;
pub use crate*;
use crate*;
pub use crate*;
use crate*;
pub use crate*;
pub use crate*;
pub use crate*;
pub use crate*;
pub use crate*;
pub use crate*;
// run code from README file