~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/examples/perl/x06.pl

  • Committer: Joachim Erfle
  • Date: 2013-07-24 13:53:41 UTC
  • Revision ID: joachim.erfle@desy.de-20130724135341-1qojpp701zsn009p
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env perl
 
2
#
 
3
# Demo x06 for the PLplot PDL binding
 
4
#
 
5
# Font demo
 
6
#
 
7
# Copyright (C) 2004  Rafael Laboissiere
 
8
#
 
9
# This file is part of PLplot.
 
10
#
 
11
# PLplot is free software; you can redistribute it and/or modify
 
12
# it under the terms of the GNU Library General Public License as published
 
13
# by the Free Software Foundation; either version 2 of the License, or
 
14
# (at your option) any later version.
 
15
#
 
16
# PLplot is distributed in the hope that it will be useful,
 
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
# GNU Library General Public License for more details.
 
20
#
 
21
# You should have received a copy of the GNU Library General Public License
 
22
# along with PLplot; if not, write to the Free Software
 
23
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
24
 
 
25
# SYNC: x06c.c 1.16
 
26
 
 
27
use PDL;
 
28
use PDL::Graphics::PLplot;
 
29
 
 
30
# Parse and process command line arguments
 
31
 
 
32
plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM);
 
33
 
 
34
# Initialize plplot
 
35
 
 
36
plinit ();
 
37
 
 
38
for ( my $kindfont = 0; $kindfont < 2; $kindfont++) {
 
39
    plfontld ( $kindfont );
 
40
    my $maxfont;
 
41
    if ( $kindfont == 0 ) {
 
42
        $maxfont = 1;
 
43
    } else {
 
44
        $maxfont = 4;
 
45
    }
 
46
    for ( my $font = 0; $font < $maxfont; $font++ ) {
 
47
        plfont( $font + 1 );
 
48
 
 
49
        pladv (0);
 
50
 
 
51
# Set up viewport and window
 
52
 
 
53
        plcol0 (2);
 
54
        plvpor (0.1, 1.0, 0.1, 0.9);
 
55
        plwind (0.0, 1.0, 0.0, 1.3);
 
56
 
 
57
# Draw the grid using plbox
 
58
 
 
59
        plbox (0.1, 0, 0.1, 0, "bcg", "bcg");
 
60
 
 
61
# Write the digits below the frame
 
62
 
 
63
        plcol0 (15);
 
64
 
 
65
        my ($i, $j, $k);
 
66
 
 
67
        for ($i = 0; $i <= 9; $i++) {
 
68
            plmtex (1.5, (0.1 * $i + 0.05), 0.5, "b", $i);
 
69
        }
 
70
 
 
71
        $k = 0;
 
72
 
 
73
        for ($i = 0; $i <= 12; $i++) {
 
74
 
 
75
            # Write the digits to the left of the frame
 
76
 
 
77
            plmtex (1.0, (1.0 - (2 * $i + 1) / 26.0), 1.0, "lv", 10 * $i);
 
78
 
 
79
            for ($j = 0; $j <= 9; $j++) {
 
80
                my $x = 0.1 * $j + 0.05;
 
81
                my $y = 1.25 - 0.1 * $i;
 
82
 
 
83
                # Display the symbols
 
84
 
 
85
                if ($k < 128) {
 
86
                    plpoin ($x, $y, $k);
 
87
                    $k++;
 
88
                }
 
89
            }
 
90
        }
 
91
 
 
92
        if ( $kindfont == 0 ) {
 
93
            plmtex (1.5, 0.5, 0.5, "t", "PLplot Example 6 - plpoin symbols (compact)");
 
94
        } else {
 
95
            plmtex (1.5, 0.5, 0.5, "t", "PLplot Example 6 - plpoin symbols (extended)");
 
96
        }
 
97
    }
 
98
}
 
99
 
 
100
plend ();