File: multiplot_options.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 (48 lines) | stat: -rw-r--r-- 1,057 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
46
47
48
// This file is released into Public Domain.
use crate::common::*;
use gnuplot::{MultiplotFillDirection::*, MultiplotFillOrder::*};

use gnuplot::*;

mod common;

fn example(c: Common)
{
	let mut fg = Figure::new();
	fg.set_multiplot_layout(2, 2)
		.set_title("Multiple parabolas")
		.set_scale(0.8, 0.8)
		.set_offset(0.0, 0.0)
		.set_multiplot_fill_order(RowsFirst, Upwards);

	fg.axes2d()
		.lines(
			&[-3., -2., -1., 0., 1., 2., 3.],
			&[9., 4., 1., 0., 1., 4., 9.],
			&[Caption("Parabola 1")],
		)
		.set_x_label("X label", &[])
		.set_title("Parabola 1", &[])
		.label("Test 1", Axis(-3.), Axis(-3.), &[])
		.label("Test 2", Axis(3.), Axis(3.), &[])
		.arrow(Axis(-3.), Axis(-3.), Axis(3.), Axis(3.), &[]);

	fg.axes2d().lines(
		&[-3., -2., -1., 0., 1., 2., 3.],
		&[10., 5., 2., 0., 2., 5., 10.],
		&[Caption("Parabola 2")],
	);

	fg.axes2d().lines(
		&[-3., -2., -1., 0., 1., 2., 3.],
		&[11., 6., 3., 0., 3., 6., 11.],
		&[Caption("Parabola 3")],
	);

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

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