pub struct PointStyle { /* private fields */ }
Implementations§
Source§impl PointStyle
impl PointStyle
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/line_and_point_svg.rs (line 13)
6fn main() {
7 let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)])
8 .line_style(
9 LineStyle::new()
10 .colour("burlywood")
11 .linejoin(LineJoin::Round),
12 )
13 .point_style(PointStyle::new());
14
15 let v = ContinuousView::new().add(l1);
16 Page::single(&v)
17 .save("line_and_point.svg")
18 .expect("saving svg");
19}
More examples
examples/scatter_text.rs (line 15)
6fn main() {
7 let data = vec![
8 (-3.0, 2.3),
9 (-1.6, 5.3),
10 (0.3, 0.7),
11 (4.3, -1.4),
12 (6.4, 4.3),
13 (8.5, 3.7),
14 ];
15 let s1 = Plot::new(data).point_style(PointStyle::new().marker(PointMarker::Circle));
16 let s2 = Plot::new(vec![(-1.4, 2.5), (7.2, -0.3)])
17 .point_style(PointStyle::new().marker(PointMarker::Square));
18
19 let v = ContinuousView::new()
20 .add(s1)
21 .add(s2)
22 .x_range(-5., 10.)
23 .y_range(-2., 6.)
24 .x_label("Some varying variable")
25 .y_label("The response of something");
26
27 println!("{}", Page::single(&v).dimensions(80, 30).to_text().unwrap());
28}
examples/scatter_svg.rs (line 19)
6fn main() {
7 // Scatter plots expect a list of pairs
8 let data1 = vec![
9 (-3.0, 2.3),
10 (-1.6, 5.3),
11 (0.3, 0.7),
12 (4.3, -1.4),
13 (6.4, 4.3),
14 (8.5, 3.7),
15 ];
16
17 // We create our scatter plot from the data
18 let s1: Plot = Plot::new(data1).point_style(
19 PointStyle::new()
20 .marker(PointMarker::Square) // setting the marker to be a square
21 .colour("#DD3355"),
22 ); // and a custom colour
23
24 // We can plot multiple data sets in the same view
25 let data2 = vec![(-1.4, 2.5), (7.2, -0.3)];
26 let s2: Plot = Plot::new(data2).point_style(
27 PointStyle::new() // uses the default marker
28 .colour("#35C788"),
29 ); // and a different colour
30
31 // The 'view' describes what set of data is drawn
32 let v = ContinuousView::new()
33 .add(s1)
34 .add(s2)
35 .x_range(-5., 10.)
36 .y_range(-2., 6.)
37 .x_label("Some varying variable")
38 .y_label("The response of something");
39
40 // A page with a single view is then saved to an SVG file
41 Page::single(&v).save("scatter.svg").unwrap();
42}
pub fn overlay(&mut self, other: &Self)
Sourcepub fn marker<T>(self, value: T) -> Selfwhere
T: Into<PointMarker>,
pub fn marker<T>(self, value: T) -> Selfwhere
T: Into<PointMarker>,
Examples found in repository?
examples/scatter_text.rs (line 15)
6fn main() {
7 let data = vec![
8 (-3.0, 2.3),
9 (-1.6, 5.3),
10 (0.3, 0.7),
11 (4.3, -1.4),
12 (6.4, 4.3),
13 (8.5, 3.7),
14 ];
15 let s1 = Plot::new(data).point_style(PointStyle::new().marker(PointMarker::Circle));
16 let s2 = Plot::new(vec![(-1.4, 2.5), (7.2, -0.3)])
17 .point_style(PointStyle::new().marker(PointMarker::Square));
18
19 let v = ContinuousView::new()
20 .add(s1)
21 .add(s2)
22 .x_range(-5., 10.)
23 .y_range(-2., 6.)
24 .x_label("Some varying variable")
25 .y_label("The response of something");
26
27 println!("{}", Page::single(&v).dimensions(80, 30).to_text().unwrap());
28}
More examples
examples/scatter_svg.rs (line 20)
6fn main() {
7 // Scatter plots expect a list of pairs
8 let data1 = vec![
9 (-3.0, 2.3),
10 (-1.6, 5.3),
11 (0.3, 0.7),
12 (4.3, -1.4),
13 (6.4, 4.3),
14 (8.5, 3.7),
15 ];
16
17 // We create our scatter plot from the data
18 let s1: Plot = Plot::new(data1).point_style(
19 PointStyle::new()
20 .marker(PointMarker::Square) // setting the marker to be a square
21 .colour("#DD3355"),
22 ); // and a custom colour
23
24 // We can plot multiple data sets in the same view
25 let data2 = vec![(-1.4, 2.5), (7.2, -0.3)];
26 let s2: Plot = Plot::new(data2).point_style(
27 PointStyle::new() // uses the default marker
28 .colour("#35C788"),
29 ); // and a different colour
30
31 // The 'view' describes what set of data is drawn
32 let v = ContinuousView::new()
33 .add(s1)
34 .add(s2)
35 .x_range(-5., 10.)
36 .y_range(-2., 6.)
37 .x_label("Some varying variable")
38 .y_label("The response of something");
39
40 // A page with a single view is then saved to an SVG file
41 Page::single(&v).save("scatter.svg").unwrap();
42}
pub fn get_marker(&self) -> PointMarker
Sourcepub fn colour<T>(self, value: T) -> Self
pub fn colour<T>(self, value: T) -> Self
Examples found in repository?
examples/scatter_svg.rs (line 21)
6fn main() {
7 // Scatter plots expect a list of pairs
8 let data1 = vec![
9 (-3.0, 2.3),
10 (-1.6, 5.3),
11 (0.3, 0.7),
12 (4.3, -1.4),
13 (6.4, 4.3),
14 (8.5, 3.7),
15 ];
16
17 // We create our scatter plot from the data
18 let s1: Plot = Plot::new(data1).point_style(
19 PointStyle::new()
20 .marker(PointMarker::Square) // setting the marker to be a square
21 .colour("#DD3355"),
22 ); // and a custom colour
23
24 // We can plot multiple data sets in the same view
25 let data2 = vec![(-1.4, 2.5), (7.2, -0.3)];
26 let s2: Plot = Plot::new(data2).point_style(
27 PointStyle::new() // uses the default marker
28 .colour("#35C788"),
29 ); // and a different colour
30
31 // The 'view' describes what set of data is drawn
32 let v = ContinuousView::new()
33 .add(s1)
34 .add(s2)
35 .x_range(-5., 10.)
36 .y_range(-2., 6.)
37 .x_label("Some varying variable")
38 .y_label("The response of something");
39
40 // A page with a single view is then saved to an SVG file
41 Page::single(&v).save("scatter.svg").unwrap();
42}
pub fn get_colour(&self) -> String
pub fn size<T>(self, value: T) -> Self
pub fn get_size(&self) -> f32
Trait Implementations§
Source§impl Clone for PointStyle
impl Clone for PointStyle
Source§fn clone(&self) -> PointStyle
fn clone(&self) -> PointStyle
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 moreSource§impl Debug for PointStyle
impl Debug for PointStyle
Source§impl Default for PointStyle
impl Default for PointStyle
Source§fn default() -> PointStyle
fn default() -> PointStyle
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PointStyle
impl RefUnwindSafe for PointStyle
impl Send for PointStyle
impl Sync for PointStyle
impl Unpin for PointStyle
impl UnwindSafe for PointStyle
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