~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/examples/perl/x24.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 x24 for the PLplot PDL binding
 
4
#
 
5
# Unicode Pace Flag
 
6
#
 
7
# Copyright (C) 2005  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
# In Debian, run like this:
 
26
#
 
27
# PLPLOT_FREETYPE_SANS_FONT=/usr/share/fonts/truetype/arphic/bkai00mp.ttf \
 
28
# PLPLOT_FREETYPE_SERIF_FONT=/usr/share/fonts/truetype/freefont/FreeSerif.ttf \
 
29
# PLPLOT_FREETYPE_MONO_FONT=/usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_hi.ttf \
 
30
# PLPLOT_FREETYPE_SCRIPT_FONT=/usr/share/fonts/truetype/unfonts/UnBatang.ttf \
 
31
# PLPLOT_FREETYPE_SYMBOL_FONT=/usr/share/fonts/truetype/ttf-bangla-fonts/JamrulNormal.ttf \
 
32
# ./x24.pl -dev png -o x24pdl.png
 
33
#
 
34
# Packages needed:
 
35
#
 
36
# ttf-arphic-bkai00mp
 
37
# ttf-freefont
 
38
# ttf-indic-fonts
 
39
# ttf-unfonts
 
40
# ttf-bangla-fonts
 
41
 
42
# For the latest Ubuntu systems lohit_hi.ttf has been moved to the
 
43
# ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you
 
44
# will have to use this package instead and update the font path.
 
45
#
 
46
 
 
47
# SYNC: x24c.c 1.6
 
48
 
 
49
use PDL;
 
50
use PDL::Graphics::PLplot;
 
51
 
 
52
my $red   = pdl [240, 204, 204, 204,   0,  39, 125];
 
53
my $green = pdl [240,   0, 125, 204, 204,  80,   0];
 
54
my $blue  = pdl [240,   0,   0,   0,   0, 204, 125];
 
55
 
 
56
my $px = pdl [0.0, 0.0, 1.0, 1.0];
 
57
my $py = pdl [0.0, 0.25, 0.25, 0.0];
 
58
 
 
59
my @sx = (
 
60
  0.16374,
 
61
  0.15844,
 
62
  0.15255,
 
63
  0.17332,
 
64
  0.50436,
 
65
  0.51721,
 
66
  0.49520,
 
67
  0.48713,
 
68
  0.83976,
 
69
  0.81688,
 
70
  0.82231,
 
71
  0.82647
 
72
);
 
73
 
 
74
my @sy = (
 
75
  0.125,
 
76
  0.375,
 
77
  0.625,
 
78
  0.875,
 
79
  0.125,
 
80
  0.375,
 
81
  0.625,
 
82
  0.875,
 
83
  0.125,
 
84
  0.375,
 
85
  0.625,
 
86
  0.875
 
87
);
 
88
 
 
89
 
 
90
# Taken from http://www.columbia.edu/~fdc/pace/
 
91
 
 
92
my @peace = (
 
93
  # Mandarin
 
94
  "#<0x00>和平",
 
95
  # Hindi
 
96
  "#<0x20>शांति",
 
97
  # English
 
98
  "#<0x10>Peace",
 
99
  # Hebrew
 
100
  "#<0x10>שלום",
 
101
  # Russian
 
102
  "#<0x10>Мир",
 
103
  # German
 
104
  "#<0x10>Friede",
 
105
  # Korean
 
106
  "#<0x30>평화",
 
107
  # French
 
108
  "#<0x10>Paix",
 
109
  # Spanish
 
110
  "#<0x10>Paz",
 
111
  # Arabic
 
112
  "#<0x10>ﺳﻼم",
 
113
  # Turkis
 
114
  "#<0x10>Barış",
 
115
  # Kurdish
 
116
  "#<0x10>Hasîtî",
 
117
);
 
118
 
 
119
plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM);
 
120
 
 
121
plinit ();
 
122
 
 
123
pladv (0);
 
124
plvpor (0.0, 1.0, 0.0, 1.0);
 
125
plwind (0.0, 1.0, 0.0, 1.0);
 
126
plcol0 (0);
 
127
plbox ("", 1.0, 0, "", 1.0, 0);
 
128
 
 
129
plscmap0n (7);
 
130
plscmap0 ($red, $green, $blue);
 
131
 
 
132
plschr (0, 4.0);
 
133
plfont (1);
 
134
 
 
135
for (my $i = 0; $i < 4; $i++) {
 
136
 
 
137
  plcol0 ($i + 1);
 
138
  plfill ($px, $py);
 
139
 
 
140
  $py += 1.0 / 4.0;
 
141
 
 
142
}
 
143
 
 
144
plcol0 (0);
 
145
for (my $i = 0; $i < 12; $i++) {
 
146
  plptex ($sx [$i], $sy [$i], 1.0, 0.0, 0.5, $peace [$i]);
 
147
}
 
148
 
 
149
plend ();
 
150