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
//! Conversion of colour arguments into colour specifications.
use ;
/// A value that can be passed wherever a colour is set.
///
/// A [`Color`] sets a fixed colour, `None` (an `Option<Color>`) draws nothing, like
/// MATLAB's `'none'`, and a [`ColorSpec`] is used as given, which allows the
/// automatic colour ([`ColorSpec::Auto`]) or a colour taken from the colormap
/// ([`ColorSpec::Colormapped`]) to be chosen.
///
/// ```
/// use ironlab::prelude::*;
///
/// let x = [0.0, 1.0, 2.0];
/// let z = Matrix::from_fn(3, 3, |row, col| (row + col) as f64);
/// let mut fig = Figure::new();
/// let mut ax = fig.axes(0, 0);
/// ax.plot(x, x).color(Color::rgb(0.8, 0.1, 0.1));
/// ax.surf(x, x, &z).edge_color(None).face_color(ColorSpec::Colormapped);
/// ```