File: dash_type.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 (38 lines) | stat: -rw-r--r-- 630 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
// This file is released into Public Domain.
use crate::common::*;
use gnuplot::*;

mod common;

fn example(c: Common)
{
	let x = 0..10;

	let mut fg = Figure::new();

	let ax = fg.axes2d();
	ax.set_title("Dash type", &[]);
	ax.set_legend(Graph(0.3), Graph(0.9), &[], &[]);
	for (i, &dt) in [Solid, SmallDot, Dot, Dash, DotDash, DotDotDash]
		.iter()
		.enumerate()
	{
		ax.lines(
			x.clone(),
			x.clone().map(|v| v * 2 + 2 * i),
			&[
				LineWidth(2.),
				Color("black"),
				LineStyle(dt),
				Caption(&format!("{:?}", dt)),
			],
		);
	}

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

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