File: fudgitrc

package info (click to toggle)
fudgit 2.42-6
  • links: PTS
  • area: non-free
  • in suites: potato, woody
  • size: 2,468 kB
  • ctags: 2,375
  • sloc: ansic: 27,729; makefile: 793; yacc: 724; lex: 102; asm: 29; fortran: 15
file content (266 lines) | stat: -rw-r--r-- 7,522 bytes parent folder | download
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#################################################
# This is an example of an init file ~/.fudgitrc
# It defines a lot of useful macros to be used
# in conjunction with gnuplot.
# Some of the ideas are from J. Ross Thomson.

#################################################
# Print a message.
echo
echo Hello there!
echo

#################################################
# Which plotting program to use.
# Default is /usr/local/bin/gnuplot
# set plotting "/usr/bin/gnuplot"

#################################################
# Use less pager instead of more.
# set pager "/usr/local/bin/less -M"

#################################################
# Some very cool prompts. Try them on ansi color!
# set prompt-fm "^[[33;1mfudgit^[[31m>^[[0m "
# set prompt-cm "^[[31;1mcmode^[[33m^[[5m>^[[0m "
# set prompt-pm "^[[31;1mpmode^[[33m^[[5m>^[[0m "

#################################################
# Macro to edit a script and then load it.
# Usage vload file
macro vl!oad 1
    vi $1
    load $1
stop

#################################################
# A macro to keep gnuplot in the same directory
# where fudgit is.
# The & means to take the unaliased definition
# Usage: cd directory
macro cd 1
    pmode cd '$1'
    &cd $1
	# Uncomment to have $Cwd in your xterm title
	#echo -n "]2;Fudgit: $Cwd "
	echo $Cwd
stop

#################################################
# Create a postscript language file of the current plot (square).
# (appends .ps to the name)
# Usage: sqpost filename
macro sqpost 1
    pmode
        set size 0.7,0.92
        set term post port 'Helvetica-Bold'
        set output '$1.ps'
        replot
        set term x11
        replot
    fmode
stop

#################################################
# Create a hard copy using the laser printer (square).
# Usage: psqpost printer_name
macro psqpost 1
    sqpost $Tmp.ps
    ! (sleep 5; lpr -P$1 $Tmp.ps ; rm -f $Tmp.ps ) &
stop

#################################################
# Creates a fig language file of the current plot.
# (appends .fig to the name)
# Usage: fig filename
macro fig 1
    pmode
        set size 0.7,1
        set term bfig
        set output '$1.fig'
        replot
        set term x11
        replot
    fmode
stop

##################################################################
# Some more Gnuplot macros.
#
# The following set of macros allows auto-replot using
# a restricted set of commands.
# Points or line and keys can be chosen from the command name too.
# Basic commands are:
#
# ResetPlot: Start a new plot;
# [t][lp]plot: plot the given vectors;
#              options: t -> titles (requires a third string argument);
#                       l -> lines;
#                       p -> points;
#
# Examples:
#
# plot Y vs. X with associated key "curve #1" and default data style:
# fudgit> tplot X Y "curve #1" 
# plot Z vs. X with points and ZFIT vs. X with line:
# fudgit> pplot X Z
# fudgit> tlplot X ZFIT "fitted model"
#############################################################

# Here we start:
#################################################
# The variable plot_num implements auto-replot
alias ResetPlot let plot_num = 0.0
# Reset now.
ResetPlot

#################################################
# Auto-replot for gnuplot (between ResetPlot calls).
# Uses default line or points (set data style ? ).
# Title is "Y vs. X", can be removed by nokey.
# Usage: plot X Y
macro pl!ot 2
    save vector $1 $2 $Tmp.$plot_num
    if (plot_num) then
         pm replot '$Tmp.$plot_num' title '$2 vs. $1'
    else 
         pm plot '$Tmp.$plot_num' title '$2 vs. $1'
    endif 
    let plot_num++
stop

#################################################
# Auto-replot for gnuplot with points.
# Title is "Y vs. X", can be removed by nokey.
# Usage: pplot X Y
macro ppl!ot 2
    save vector $1 $2 $Tmp.$plot_num
    if (plot_num) then
         pm replot '$Tmp.$plot_num' title '$2 vs. $1' with points 1 2 
    else 
         pm plot '$Tmp.$plot_num' title '$2 vs. $1' with points 1 2
    endif 
    let plot_num++
stop

#################################################
# Auto-replot for gnuplot with lines.
# Title is "Y vs. X", can be removed by nokey.
# Usage: lplot X Y
macro lpl!ot 2
    save vector $1 $2 $Tmp.$plot_num
    if (plot_num) then
         pm replot '$Tmp.$plot_num' title '$2 vs. $1' with lines
    else 
         pm plot '$Tmp.$plot_num' title '$2 vs. $1' with lines
    endif 
    let plot_num++
stop

#################################################
# Auto-replot for gnuplot with default lines/points and given titles.
# Usage: tplot X Y title
macro tpl!ot 3
    save vector $1 $2 $Tmp.$plot_num
    if (plot_num) then
         pm replot '$Tmp.$plot_num' title '$3'
    else 
         pm plot '$Tmp.$plot_num' title '$3'
    endif 
    let plot_num++
stop

#################################################
# Auto-replot for gnuplot with lines and given titles.
# Usage: tlplot X Y title
macro tlpl!ot 3
    save vector $1 $2 $Tmp.$plot_num
    if (plot_num) then
         pm replot '$Tmp.$plot_num' title '$3' with lines
    else 
         pm plot '$Tmp.$plot_num' title '$3' with lines
    endif 
    let plot_num++
stop

#################################################
# Auto-replot for gnuplot with points and given titles.
# Usage: tpplot X Y title
macro tppl!ot 3
    save vector $1 $2 $Tmp.$plot_num
    if (plot_num) then
         pm replot '$Tmp.$plot_num' title '$3' with points 1 2
    else 
         pm plot '$Tmp.$plot_num' title '$3' with points 1 2
    endif 
    let plot_num++
stop

############################################################
# The following macros are used to generate gnuplot scripts
# instead of generating direct commands.
############################################################

#################################################
# Init batch plot
# Usage: initbatch
macro initbat!ch 0
    set output $Tmp.batch
stop

#################################################
# Plot for gnuplot batch plots and titles. Default data style.
# Generates a gnuplot script to be loaded by gnuplot later on.
# You can create the whole family b[t][lp]plot above if
# you need it. (Or as an exercise :-) ).
# Usage: btplot X Y title
macro btpl!ot 3
    save vector $1 $2 $Tmp.$plot_num
    if (plot_num) then
        let print ", '$Tmp.$plot_num' title '$3'"
    else 
        let print "plot '$Tmp.$plot_num' title '$3'"
    endif 
    let plot_num++
stop

#################################################
# Tell gnuplot to load the script.
# Usage: batchplot
macro bat!chplot 0
    let print "\n" 
    set output stdout
    pmode load "$Tmp.batch"
    pmode pause 0  "Batch plotted"
stop

#################################################
# A bunch of useful Gnuplot aliases.
alias rep!lot    pm replot
alias log        pm set log
alias nolog      pm set nolog
alias xrange     pm set xrange
alias yrange     pm set yrange
alias auto       pm set auto
alias title      pm set title
alias xlabel     pm set xlabel
alias ylabel     pm set ylabel
alias line!s     pm set data style line
alias point!s    pm set data style points
alias nokey      pm set nokey
alias key        pm set key
alias format     pm set format 
alias source     load

#################################################
# A bunch of useful UNiX aliases.
alias date    !date
alias mv      !mv -i
alias cp      !cp -i
alias rm      !rm -i
alias m       !more -c

#################################################
# I mean show and not shell when I only type sh.
alias sh     show