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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <gset.h>
include "imexam.h"
define MTYPES "|point|box|plus|cross|circle|hebar|vebar|hline|vline|diamond|"
define IE_GBUF 0.10 # Buffer around data
define IE_SZTITLE 512 # Size of multiline title
# IE_GRAPH -- Make a graph
# This procedure is used by most of the different graph types to provide
# consistency in features and parameters. The parameters are read using
# the pset pointer.
procedure ie_graph (gp, mode, pp, param, x, y, npts, label, format)
pointer gp # GIO pointer
int mode # Mode
pointer pp # PSET pointer
char param[ARB] # Parameter string
real x[npts] # X data
real y[npts] # Y data
int npts # Number of points
char label # Default x label
char format # Default x format
int i, marks[10], linepattern, patterns[4], clgpseti(), btoi(), strdic()
pointer sp, title, xlabel, ylabel
real x1, x2, y1, y2, wx1, wx2, wy1, wy2, temp, szmarker
real clgpsetr(), ie_iformatr()
bool clgpsetb(), streq()
data patterns/GL_SOLID, GL_DASHED, GL_DOTTED, GL_DOTDASH/
data marks/GM_POINT, GM_BOX, GM_PLUS, GM_CROSS, GM_CIRCLE, GM_HEBAR,
GM_VEBAR, GM_HLINE, GM_VLINE, GM_DIAMOND/
begin
call smark (sp)
call salloc (xlabel, SZ_LINE, TY_CHAR)
# If a new graph setup all the axes and labeling options and then
# make the graph.
if (mode == NEW_FILE) {
call gclear (gp)
linepattern = 0
x1 = ie_iformatr (clgpsetr (pp, "x1"), format)
x2 = ie_iformatr (clgpsetr (pp, "x2"), format)
y1 = clgpsetr (pp, "y1")
y2 = clgpsetr (pp, "y2")
if (IS_INDEF (x1) || IS_INDEF (x2))
call gascale (gp, x, npts, 1)
if (IS_INDEF (y1) || IS_INDEF (y2))
call gascale (gp, y, npts, 2)
call gswind (gp, x1, x2, y1, y2)
call ggwind (gp, wx1, wx2, wy1, wy2)
temp = wx2 - wx1
if (IS_INDEF (x1))
wx1 = wx1 - IE_GBUF * temp
if (IS_INDEF (x2))
wx2 = wx2 + IE_GBUF * temp
temp = wy2 - wy1
if (IS_INDEF (y1))
wy1 = wy1 - IE_GBUF * temp
if (IS_INDEF (y2))
wy2 = wy2 + IE_GBUF * temp
call gswind (gp, wx1, wx2, wy1, wy2)
call gsetr (gp, G_ASPECT, 0.)
call gseti (gp, G_ROUND, btoi (clgpsetb (pp, "round")))
i = GW_LINEAR
if (clgpsetb (pp, "logx"))
i = GW_LOG
call gseti (gp, G_XTRAN, i)
i = GW_LINEAR
if (clgpsetb (pp, "logy"))
i = GW_LOG
call gseti (gp, G_YTRAN, i)
if (clgpsetb (pp, "box")) {
# Get number of major and minor tick marks.
call gseti (gp, G_XNMAJOR, clgpseti (pp, "majrx"))
call gseti (gp, G_XNMINOR, clgpseti (pp, "minrx"))
call gseti (gp, G_YNMAJOR, clgpseti (pp, "majry"))
call gseti (gp, G_YNMINOR, clgpseti (pp, "minry"))
# Label tick marks on axes?
call gsets (gp, G_XTICKFORMAT, format)
call gseti (gp, G_LABELTICKS,
btoi (clgpsetb (pp, "ticklabels")))
# Fetch labels and plot title string.
call salloc (title, IE_SZTITLE, TY_CHAR)
call salloc (ylabel, SZ_LINE, TY_CHAR)
if (clgpsetb (pp, "banner")) {
call sysid (Memc[title], IE_SZTITLE)
call strcat ("\n", Memc[title], IE_SZTITLE)
call strcat (param, Memc[title], IE_SZTITLE)
} else
Memc[title] = EOS
call clgpset (pp, "title", Memc[xlabel], SZ_LINE)
if (Memc[xlabel] != EOS) {
call strcat ("\n", Memc[title], IE_SZTITLE)
call strcat (Memc[xlabel], Memc[title], IE_SZTITLE)
}
call clgpset (pp, "xlabel", Memc[xlabel], SZ_LINE)
call clgpset (pp, "ylabel", Memc[ylabel], SZ_LINE)
if (streq ("wcslabel", Memc[xlabel]))
call strcpy (label, Memc[xlabel], SZ_LINE)
call glabax (gp, Memc[title], Memc[xlabel], Memc[ylabel])
}
}
# Draw the data.
if (clgpsetb (pp, "pointmode")) {
call clgpset (pp, "marker", Memc[xlabel], SZ_LINE)
i = strdic (Memc[xlabel], Memc[xlabel], SZ_LINE, MTYPES)
if (i == 0)
i = 2
if (marks[i] == GM_POINT)
szmarker = 0.0
else
szmarker = clgpsetr (pp, "szmarker")
call gpmark (gp, x, y, npts, marks[i], szmarker, szmarker)
} else {
linepattern = min (4, linepattern + 1)
call gseti (gp, G_PLTYPE, patterns[linepattern])
call gpline (gp, x, y, npts)
}
call gflush (gp)
call sfree (sp)
end
|