File: ex_hlines.ppl

package info (click to toggle)
pyxplot 0.9.2-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,288 kB
  • sloc: ansic: 50,373; xml: 1,339; python: 570; sh: 318; makefile: 89
file content (104 lines) | stat: -rw-r--r-- 2,892 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# ex_hlines.ppl
#
# The code in this file is part of Pyxplot
# <http://www.pyxplot.org.uk>
#
# Copyright (C) 2006-2012 Dominic Ford <coders@pyxplot.org.uk>
#               2008-2012 Ross Church
#
# $Id: ex_hlines.ppl 1261 2012-07-11 21:38:05Z dcf21 $
#
# Pyxplot is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# You should have received a copy of the GNU General Public License along with
# Pyxplot; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA  02110-1301, USA

# ----------------------------------------------------------------------------

# This script produces a figure for the Pyxplot Users' Guide

# Call common initialisation script
reset
title = "ex_hlines"
load "examples/fig_init.ppl"
set terminal landscape

# BEGIN
set numeric display latex
set width 20
set size ratio 0.4
set numerics sf 4
set log x
set x1label "Wavelength"
set x2label "Frequency"     ; set unit of frequency Hz
set x3label "Photon Energy" ; set unit of energy eV
set axis x2 linked x1 using phy.c/x
set axis x3 linked x2 using phy.h*x
set noytics ; set nomytics

# Draw lines of first four series of hydrogen lines
an=2
n=1
foreach SeriesName in ["Ly","Ba","Pa","Br"]
 {
  for m=n+1 to n+21
   {
    wl = 1/(phy.Ry*(1/n**2-1/m**2))
    set arrow an from wl,0.3 to wl,0.6 with nohead col n
    if (m-n==1) { ; GreekLetter = r"\alpha" ; }
    if (m-n==2) { ; GreekLetter = r"\beta"  ; }
    if (m-n==3) { ; GreekLetter = r"\gamma" ; }
    if (m-n<4)
     {
      set label an r"\parbox{5cm}{\footnotesize\center{\
        %s-$%s$\newline $%d\to%d$\newline %s\newline}}" \
        %(SeriesName,GreekLetter,m,n,wl) at wl,0.55+0.2*(m-n) \
        hal center val center
     }
    an = an+1
   }
  n=n+1
 }

# Label astronomical photometric colors
foreach datum i,name,wl_c,wl_w in "--" using \
    1:"%s"%($2):($3*unit(nm)):($4*unit(nm))
 {
  arry = 0.12+0.1*(i%2) # Vertical positions for arrows
  laby = 0.07+0.1*(i%2) # Vertical positions for labels
  x0 = (wl_c-wl_w/2) # Shortward end of passband
  x1 =  wl_c         # Centre of passband
  x2 = (wl_c+wl_w/2) # Longward end of passband
  set arrow an from x0,arry to x2,arry with nohead
  set label an name at x1,laby hal center val center
  an = an+1
 }
 1 U  365   66
 2 B  445   94
 3 V  551   88
 4 R  658  138
 5 I  806  149
 6 J 1220  213
 7 H 1630  307
 8 K 2190  390
 9 L 3450  472
10 M 4750  460
END

# Draw a marker for the Lyman limit
ll = 91.1267*unit(nm)
set arrow 1 from ll,0.12 to ll,0.22
set label 1 "Lyman Limit: %s"%(ll) at 95*unit(nm),0.17 \
     hal left val center

# Finally produce plot
plot [80*unit(nm):5500*unit(nm)][0:1.25]
# END

# Call common cleanup script
load "examples/fig_end.ppl"