Overview
Comment:Added multiplot feature allowing graphs to be overlaid.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0aca95f6ff78bbf6b087130920e9eed8fcf1469717e10e984e510fb22e2982d8
User & Date: geraint@users.sourceforge.net on 2002-07-11 20:46:37
Other Links: branch diff | manifest | tags
Context
2002-07-12
15:13:17
Added the ability to load and save gnuplot instructions to file.
Added grid and co-ordinate options.
Moved print option into menubar (under File).
check-in: 22d10f4c89 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-07-11
20:46:37
Added multiplot feature allowing graphs to be overlaid. check-in: 0aca95f6ff user: geraint@users.sourceforge.net tags: origin/master, trunk
13:00:23
Declared more function arguments to be "const" - improves compiler optimisation. check-in: 5f9fba536f user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/struc2gnuplot_txt2wish from [3601be40d3] to [a8ed17a5f7].

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    foreach name [split \$temp_list \$delim] {
	set list \$list\$delim[reverse_name \$name]
    }
    return \$list
}

proc "sort_list" "list sortorder" {
    puts "sortorder: \$sortorder"
    if ("\$sortorder"=="normal") {
	return [lsort -ascii \$list]
    }
    if ("\$sortorder"=="reverse") {
	return [reverse_sort \$list]
    }
}







<







75
76
77
78
79
80
81

82
83
84
85
86
87
88
    foreach name [split \$temp_list \$delim] {
	set list \$list\$delim[reverse_name \$name]
    }
    return \$list
}

proc "sort_list" "list sortorder" {

    if ("\$sortorder"=="normal") {
	return [lsort -ascii \$list]
    }
    if ("\$sortorder"=="reverse") {
	return [reverse_sort \$list]
    }
}
114
115
116
117
118
119
120
121
122







123
124
125
126
127
128
129
130
131
132
133
134
135

pack .cx.l -expand true -fill both -side left
pack .cy.l -expand true -fill both -side left

pack .cx -expand true -fill both
place .cy -in .cx -relx 0 -rely 0 -relwidth 1 -relheight 1 -anchor nw -bordermode outside

radiobutton .states  -text "States"  -value states  -variable view -command { raise .cx } -relief solid
radiobutton .outputs -text "Outputs" -value outputs -variable view -command { raise .cy } -relief solid








pack .states .outputs -side left

pack .quit   -expand false -fill x -side right
pack .print  -expand false -fill x -side right


## map names to column numbers
EOF

gawk '
BEGIN {
    print "proc \"plot\" \"title\" {";







|
|
>
>
>
>
>
>
>





|







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

pack .cx.l -expand true -fill both -side left
pack .cy.l -expand true -fill both -side left

pack .cx -expand true -fill both
place .cy -in .cx -relx 0 -rely 0 -relwidth 1 -relheight 1 -anchor nw -bordermode outside

radiobutton .states  -text "States"      -value states  -variable view      -relief solid -command { raise .cx }
radiobutton .outputs -text "Outputs"     -value outputs -variable view      -relief solid -command { raise .cy }

#menubutton .plottype -text "Plot type" -menu .plottype.plottype

#menu .plottype.plottype
tk_optionMenu .plottype plottype "Single Plot"\
                                 "Multi Plot "\
                                 "New Window "

pack .states .outputs -side left

pack .quit   -expand false -fill x -side right
pack .print  -expand false -fill x -side right
pack .plottype   -expand false -fill x -side top

## map names to column numbers
EOF

gawk '
BEGIN {
    print "proc \"plot\" \"title\" {";
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
' Title=\$title Ny=${Ny} ${struc} >> ${out}


cat <<EOF >> ${out}

## call gnuplot
proc "plot_var" "title column" {
    exec echo set grid\; > ${tmp}



    exec echo plot \"${dat2}\" using 1:\$column title \"\$title\" with lines\; >> ${tmp}
    exec echo exit\; >> ${tmp}

    exec gnuplot -geometry 400x300 -persist -title "\$title" ${tmp} &



}

## print output
proc "print" "parameter" {
    set filename [tk_getSaveFile\
	-initialdir ".."\
	-initialfile "\$parameter.ps"\
	-defaultextension ".ps"\
	-filetypes {
	    {{Postscript} {.ps}}
	    {{All files} {*}}
	}
    ]
    if {\$filename != ""} {
	exec echo set term postscript > ${tmp}.print
	exec echo set output \"\$filename\" >> ${tmp}.print
	exec grep -v pause ${tmp} >> ${tmp}.print
	exec gnuplot ${tmp}.print
	puts "Graph printed to \$filename"
    }
}

EOF
chmod +x ${out}







|
>
>
>
|
<
>
|
>
>
>














|
|
<
|
|





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
' Title=\$title Ny=${Ny} ${struc} >> ${out}


cat <<EOF >> ${out}

## call gnuplot
proc "plot_var" "title column" {
    puts "set grid"
    puts "set term X11"
    global plottype
    if {"\$plottype" == "Multi Plot "} {
	puts "replot '${dat2}' using 1:\$column title '\$title' with lines"

    } elseif {"\$plottype" == "New Window "} {
	puts "! echo \"plot '${dat2}' using 1:\$column title '\$title' with lines\" | gnuplot -geometry 400x300 -persist"
    } else {
	puts "plot '${dat2}' using 1:\$column title '\$title' with lines"
    }
}

## print output
proc "print" "parameter" {
    set filename [tk_getSaveFile\
	-initialdir ".."\
	-initialfile "\$parameter.ps"\
	-defaultextension ".ps"\
	-filetypes {
	    {{Postscript} {.ps}}
	    {{All files} {*}}
	}
    ]
    if {\$filename != ""} {
	puts "set term postscript"
	puts "set output \"\$filename\""

	puts "replot"
	tk_dialog ".printed" "Graph Printed!" "PostScript saved as \$filename" "" "0" "Close"
    }
}

EOF
chmod +x ${out}

Modified mttroot/mtt/lib/rep/gnuplot_rep.make from [95bd623855] to [cb814bcb10].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*-makefile-*-
# create a gnuplot input file

MTTFLAGS	= $(OPTS)

all: $(SYS)_gnuplot.$(LANG)

$(SYS)_gnuplot.view: $(SYS)_gnuplot.wish $(SYS)_odes.dat2
	sh $(SYS)_gnuplot.wish

$(SYS)_gnuplot.wish: $(SYS)_struc.txt
	$(MTTPATH)/trans/struc2gnuplot_txt2wish $(SYS)

$(SYS)_gnuplot.txt: $(SYS)_struc.txt $(MTTPATH)/trans/struc2gnuplot_txt.exe
	$(MTTPATH)/trans/struc2gnuplot_txt.exe $(SYS) < $(SYS)_struc.txt > $(SYS)_gnuplot.txt









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*-makefile-*-
# create a gnuplot input file

MTTFLAGS	= $(OPTS)

all: $(SYS)_gnuplot.$(LANG)

$(SYS)_gnuplot.view: $(SYS)_gnuplot.wish $(SYS)_odes.dat2
	sh $(SYS)_gnuplot.wish | gnuplot -geometry 400x300

$(SYS)_gnuplot.wish: $(SYS)_struc.txt
	$(MTTPATH)/trans/struc2gnuplot_txt2wish $(SYS)

$(SYS)_gnuplot.txt: $(SYS)_struc.txt $(MTTPATH)/trans/struc2gnuplot_txt.exe
	$(MTTPATH)/trans/struc2gnuplot_txt.exe $(SYS) < $(SYS)_struc.txt > $(SYS)_gnuplot.txt


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]