File: box_and_whisker.rs

package info (click to toggle)
rust-gnuplot 0.0.39-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 532 kB
  • sloc: makefile: 2
file content (45 lines) | stat: -rw-r--r-- 889 bytes parent folder | download
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
// This file is released into Public Domain.
use crate::common::*;
use gnuplot::*;

mod common;

fn example(c: Common)
{
	let mut fg = Figure::new();

	fg.axes2d()
		.set_title("Box and whisker", &[])
		.box_and_whisker(
			[0.0f32, 1.0, 2.0].iter(),
			[-1.0f32, 0.0, 1.0].iter(),
			[-2.0f32, -1.0, 0.0].iter(),
			[2.0f32, 3.0, 4.0].iter(),
			[1.0f32, 2.0, 3.0].iter(),
			&[],
		)
		.box_and_whisker_set_width(
			[-0.6f32, 1.5, 2.5].iter(),
			[-1.0f32, 0.0, 1.0].iter(),
			[-2.0f32, -1.0, 0.0].iter(),
			[2.0f32, 3.0, 4.0].iter(),
			[1.0f32, 2.0, 3.0].iter(),
			[0.5f32, 0.25, 0.125].iter(),
			&[
				WhiskerBars(0.5),
				Color("blue"),
				LineWidth(2.0),
				LineStyle(SmallDot),
				FillAlpha(0.5),
			],
		)
		.set_x_range(Fix(-1.0), Fix(3.0))
		.set_y_range(Fix(-3.0), Fix(5.0));

	c.show(&mut fg, "box_and_whisker");
}

fn main()
{
	Common::new().map(|c| example(c));
}