File: multiplot_1.pl

package info (click to toggle)
libchart-gnuplot-perl 0.23-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 944 kB
  • sloc: perl: 4,862; makefile: 113
file content (61 lines) | stat: -rwxr-xr-x 1,513 bytes parent folder | download | duplicates (6)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;

#----------------------------------------
# Demonstrate how to plot multiplot chart
# - Use "add"-"multiplot" method pair
#----------------------------------------

my $multiChart = Chart::Gnuplot->new(
    output => "gallery/multiplot_1.png",
    title  => "Multiplot chart",
);

#----------------------------------------
# Top left chart
my @charts = ();
$charts[0][0] = Chart::Gnuplot->new(
    title => "Top left chart",
);
my $dataSet = Chart::Gnuplot::DataSet->new(
    func => "sin(x)",
);
$charts[0][0]->add2d($dataSet);
#----------------------------------------

#----------------------------------------
# Top right chart
$charts[0][1] = Chart::Gnuplot->new(
    title => "Top right chart",
);
$dataSet = Chart::Gnuplot::DataSet->new(
    func => "cos(x)",
);
$charts[0][1]->add2d($dataSet);
#----------------------------------------

#----------------------------------------
# Bottom left chart
$charts[1][0] = Chart::Gnuplot->new(
    title => "Bottom left chart",
);
$dataSet = Chart::Gnuplot::DataSet->new(
    func => "exp(x)",
);
$charts[1][0]->add2d($dataSet);
#----------------------------------------

#----------------------------------------
# Bottom right chart
$charts[1][1] = Chart::Gnuplot->new(
    title => "Bottom right chart",
);
$dataSet = Chart::Gnuplot::DataSet->new(
    func => "log(x)",
);
$charts[1][1]->add2d($dataSet);
#----------------------------------------

# Plot the multplot chart
$multiChart->multiplot(\@charts);