summaryrefslogtreecommitdiffstats
path: root/ds9/library/plotstate.tcl
blob: 333679d382bee49eb61ef3f162157dce41c62e6e (plain)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#  Copyright (C) 1999-2018
#  Smithsonian Astrophysical Observatory, Cambridge, MA, USA
#  For conditions of distribution and use, see copyright notice in "copyright"

package provide DS9 1.0

# Plot State
proc PlotDefState {} {
    global pap

    # per Canvas
    set pap(graph,bg) white
    set pap(graph,title,family) helvetica
    set pap(graph,title,size) 12
    set pap(graph,title,weight) normal
    set pap(graph,title,slant) roman

    set pap(legend,title,family) helvetica
    set pap(legend,title,size) 10
    set pap(legend,title,weight) normal
    set pap(legend,title,slant) roman
    set pap(legend,font,family) helvetica
    set pap(legend,font,size) 9
    set pap(legend,font,weight) normal
    set pap(legend,font,slant) roman

    set pap(axis,title,family) helvetica
    set pap(axis,title,size) 9
    set pap(axis,title,weight) normal
    set pap(axis,title,slant) roman

    set pap(axis,font,family) helvetica
    set pap(axis,font,size) 9
    set pap(axis,font,weight) normal
    set pap(axis,font,slant) roman

    # per Graph
    set pap(graph,title) {}

    set pap(legend) 0
    set pap(legend,title) Legend
    set pap(legend,position) right

    set pap(axis,x,title) {}
    set pap(axis,x,grid) 1
    set pap(axis,x,log) 0
    set pap(axis,x,flip) 0
    set pap(axis,x,auto) 1
    set pap(axis,x,min) {}
    set pap(axis,x,max) {}
    set pap(axis,x,format) {}

    set pap(axis,y,title) {}
    set pap(axis,y,grid) 1
    set pap(axis,y,log) 0
    set pap(axis,y,flip) 0
    set pap(axis,y,auto) 1
    set pap(axis,y,min) {}
    set pap(axis,y,max) {}
    set pap(axis,y,format) {}

    set pap(bar,mode) normal

    # per DataSet
    set pap(graph,ds,name) {}
    set pap(graph,ds,show) 1
    set pap(graph,ds,smooth) linear
    set pap(graph,ds,color) black
    set pap(graph,ds,fill) 0
    set pap(graph,ds,fill,color) black
    set pap(graph,ds,width) 1
    set pap(graph,ds,dash) 0

    set pap(shape,symbol) none
    set pap(shape,fill) 1
    set pap(shape,color) red

    set pap(error) 1
    set pap(error,cap) 0
    set pap(error,color) red
    set pap(error,width) 1

    set pap(bar,relief) raised
}

proc PlotInitState {varname} {
    upvar #0 $varname var
    global $varname

    global pap

    set cc $var(graph,current)

    # per Graph
    set var(graph$cc,bar,mode) $pap(bar,mode)

    # per DataSet
    set var(graph,ds,name) $pap(graph,ds,name)
    set var(graph,ds,show) $pap(graph,ds,show)
    set var(graph,ds,smooth) $pap(graph,ds,smooth)
    set var(graph,ds,color) $pap(graph,ds,color)
    set var(graph,ds,fill) $pap(graph,ds,fill)
    set var(graph,ds,fill,color) $pap(graph,ds,fill,color)
    set var(graph,ds,width) $pap(graph,ds,width)
    set var(graph,ds,dash) $pap(graph,ds,dash)

    set var(graph$cc,shape,symbol) $pap(shape,symbol)
    set var(graph$cc,shape,fill) $pap(shape,fill)
    set var(graph$cc,shape,color) $pap(shape,color)

    set var(graph$cc,error) $pap(error)
    set var(graph$cc,error,cap) $pap(error,cap)
    set var(graph$cc,error,color) $pap(error,color)
    set var(graph$cc,error,width) $pap(error,width)

    set var(graph$cc,bar,relief) $pap(bar,relief)
}

proc PlotSaveState {varname} {
    upvar #0 $varname var
    global $varname

    set cc $var(graph,current)
    set nn $var(graph$cc,data,current)

    # per DataSet
    set var(graph$cc,$nn,name) $var(graph,ds,name)
    set var(graph$cc,$nn,show) $var(graph,ds,show)
    set var(graph$cc,$nn,smooth) $var(graph,ds,smooth)
    set var(graph$cc,$nn,color) $var(graph,ds,color)
    set var(graph$cc,$nn,fill) $var(graph,ds,fill)
    set var(graph$cc,$nn,fill,color) $var(graph,ds,fill,color)
    set var(graph$cc,$nn,width) $var(graph,ds,width)
    set var(graph$cc,$nn,dash) $var(graph,ds,dash)

    set var(graph$cc,$nn,shape,symbol) $var(graph$cc,shape,symbol)
    set var(graph$cc,$nn,shape,fill) $var(graph$cc,shape,fill)
    set var(graph$cc,$nn,shape,color) $var(graph$cc,shape,color)

    set var(graph$cc,$nn,error) $var(graph$cc,error)
    set var(graph$cc,$nn,error,cap) $var(graph$cc,error,cap)
    set var(graph$cc,$nn,error,color) $var(graph$cc,error,color)
    set var(graph$cc,$nn,error,width) $var(graph$cc,error,width)

    set var(graph$cc,$nn,bar,relief) $var(graph$cc,bar,relief)
}

proc PlotRestoreState {varname nn} {
    upvar #0 $varname var
    global $varname

    set cc $var(graph,current)
    set nn $var(graph$cc,data,current)

    # per DataSet
    set var(graph,ds,name) $var(graph$cc,$nn,name)
    set var(graph,ds,show) $var(graph$cc,$nn,show) 
    set var(graph,ds,smooth) $var(graph$cc,$nn,smooth) 
    set var(graph,ds,color) $var(graph$cc,$nn,color) 
    set var(graph,ds,fill) $var(graph$cc,$nn,fill) 
    set var(graph,ds,fill,color) $var(graph$cc,$nn,fill,color) 
    set var(graph,ds,width) $var(graph$cc,$nn,width) 
    set var(graph,ds,dash) $var(graph$cc,$nn,dash) 

    set var(graph$cc,shape,symbol) $var(graph$cc,$nn,shape,symbol) 
    set var(graph$cc,shape,fill) $var(graph$cc,$nn,shape,fill) 
    set var(graph$cc,shape,color) $var(graph$cc,$nn,shape,color)

    set var(graph$cc,error) $var(graph$cc,$nn,error) 
    set var(graph$cc,error,cap) $var(graph$cc,$nn,error,cap) 
    set var(graph$cc,error,color) $var(graph$cc,$nn,error,color) 
    set var(graph$cc,error,width) $var(graph$cc,$nn,error,width) 

    set var(graph$cc,bar,relief) $var(graph$cc,$nn,bar,relief) 
}