~ubuntu-branches/debian/sid/libchart-gnuplot-perl/sid

« back to all changes in this revision

Viewing changes to examples/legend_6.pl

  • Committer: Bazaar Package Importer
  • Author(s): Alejandro Garrido Mota
  • Date: 2009-04-06 01:15:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090406011513-ek87d0uk05f4icqi
Tags: upstream-0.09
ImportĀ upstreamĀ versionĀ 0.09

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
use strict;
 
3
use Chart::Gnuplot;
 
4
 
 
5
# Demonstration of formatting legend
 
6
# - title of the legend
 
7
 
 
8
my $chart = Chart::Gnuplot->new(
 
9
    output => "gallery/legend_6.png",
 
10
    title  => 'Legend with title',
 
11
    legend => {
 
12
        title  => 'Legend title',
 
13
        border => 'on',
 
14
    },
 
15
);
 
16
 
 
17
# Lines
 
18
my $lines = Chart::Gnuplot::DataSet->new(
 
19
    func  => "cos(x)",
 
20
    title => "cosine",
 
21
);
 
22
 
 
23
# Points
 
24
my $points = Chart::Gnuplot::DataSet->new(
 
25
    func  => "sin(x)",
 
26
    title => "sine",
 
27
);
 
28
 
 
29
# Points on line
 
30
my $linespoints = Chart::Gnuplot::DataSet->new(
 
31
    func  => "x**2",
 
32
    title => "quadratic",
 
33
);
 
34
 
 
35
# Plot the graph
 
36
$chart->plot2d($lines, $points, $linespoints);