Overview
Comment: | Added selection of any variable for X, Y and Z axes. Added 3D plots. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
40412365f6d9b8ff5076fd3feddba435 |
User & Date: | geraint@users.sourceforge.net on 2002-07-17 19:37:54 |
Other Links: | branch diff | manifest | tags |
Context
2002-07-19
| ||
19:37:15 |
Added adjustment of axis ranges, contour plots, gridlines, timestamp. Replaced some if..then..else statements with switch statements. check-in: 50d0b4198b user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2002-07-17
| ||
19:37:54 |
Added selection of any variable for X, Y and Z axes. Added 3D plots. check-in: 40412365f6 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2002-07-16
| ||
18:07:07 |
Changed method of switching between states and outputs; listbox list is reconfigured instead of overlapping canvases - reduces cut&paste code. Other cosmetic changes including menu hotkeys. check-in: 02021d0c50 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/struc2gnuplot_txt2wish from [79ab7375ab] to [8f6e7334ea].
︙ | ︙ | |||
16 17 18 19 20 21 22 | cat <<EOF > ${out} #!/bin/sh # Next line replaces shell with wish\\ exec wish "\$0" "\$@" ## main window wm title . "MTT Viewer: ${sys}" | < < < | | | | | | > > > > > > > > > | 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 | cat <<EOF > ${out} #!/bin/sh # Next line replaces shell with wish\\ exec wish "\$0" "\$@" ## main window wm title . "MTT Viewer: ${sys}" # menu bar canvas .menubar menubutton .menubar.file -text "File" -underline 0 -menu .menubar.file.menu menu .menubar.file.menu .menubar.file.menu add command -label "Open (Gnuplot template)" -underline 0 -command open_plotfile .menubar.file.menu add command -label "Save (Gnuplot template)" -underline 0 -command save_plotfile .menubar.file.menu add separator .menubar.file.menu add command -label "Print (PostScript)" -underline 0 -command print_postscript .menubar.file.menu add separator .menubar.file.menu add command -label "Quit" -underline 0 -command exit menubutton .menubar.edit -text "Edit" -underline 0 -menu .menubar.edit.menu menu .menubar.edit.menu .menubar.edit.menu add cascade -label "Axes" -underline 0 -menu .menubar.edit.menu.axes .menubar.edit.menu add cascade -label "Grid" -underline 0 -menu .menubar.edit.menu.grid .menubar.edit.menu add cascade -label "Key" -underline 0 -menu .menubar.edit.menu.key menu .menubar.edit.menu.axes .menubar.edit.menu.axes add command -label "Cartesian" -underline 0 -command { puts "set nopolar ; replot" } .menubar.edit.menu.axes add command -label "Polar" -underline 0 -command { puts "set polar ; replot" } menu .menubar.edit.menu.grid .menubar.edit.menu.grid add command -label "Show Grid" -underline 0 -command { puts "set grid ; replot" } .menubar.edit.menu.grid add command -label "Hide Grid" -underline 0 -command { puts "set nogrid ; replot" } menu .menubar.edit.menu.key .menubar.edit.menu.key add command -label "Show Key" -underline 0 -command { puts "set key ; replot" } .menubar.edit.menu.key add command -label "Hide Key" -underline 0 -command { puts "set nokey ; replot" } .menubar.edit.menu.key add cascade -label "Position" -underline 0 -menu .menubar.edit.menu.key.posn menu .menubar.edit.menu.key.posn .menubar.edit.menu.key.posn add command -label "Left" -underline 0 -command { puts "set key left ; replot" } .menubar.edit.menu.key.posn add command -label "Right" -underline 0 -command { puts "set key right ; replot" } .menubar.edit.menu.key.posn add command -label "Top" -underline 0 -command { puts "set key top ; replot" } .menubar.edit.menu.key.posn add command -label "Bottom" -underline 0 -command { puts "set key bottom ; replot" } .menubar.edit.menu.key.posn add command -label "Outside" -underline 0 -command { puts "set key outside ; replot" } .menubar.edit.menu.key.posn add command -label "Below" -underline 3 -command { puts "set key below ; replot" } menubutton .menubar.tool -text "Tools" -underline 0 -menu .menubar.tool.menu menu .menubar.tool.menu .menubar.tool.menu add cascade -label "Sort List" -underline 0 -menu .menubar.tool.menu.sort .menubar.tool.menu add command -label "X-MTT" -underline 0 -command { exec xmtt & } menu .menubar.tool.menu.sort |
︙ | ︙ | |||
74 75 76 77 78 79 80 | button .menubar.quit -text "Quit" -relief flat -command exit pack .menubar.file -expand false -fill x -side left pack .menubar.edit -expand false -fill x -side left pack .menubar.tool -expand false -fill x -side left pack .menubar.quit -expand false -fill x -side right | | | | | < | | | > > > > > > > > > > > > | | > > > > > > > > > > | > > > > | 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 | button .menubar.quit -text "Quit" -relief flat -command exit pack .menubar.file -expand false -fill x -side left pack .menubar.edit -expand false -fill x -side left pack .menubar.tool -expand false -fill x -side left pack .menubar.quit -expand false -fill x -side right # list bar canvas .listbar radiobutton .listbar.states -text "States" -value states -variable view -command { .parameters.list configure -listvar xl } radiobutton .listbar.outputs -text "Outputs" -value outputs -variable view -command { .parameters.list configure -listvar yl } checkbutton .listbar.sort -text "Toggle Sort" -relief flat -indicatoron false -onvalue "reverse" -offvalue "normal" -variable sortorder -command { set xl [sort_list \$xl \$sortorder ] set yl [sort_list \$yl \$sortorder ] } pack .listbar.states -expand false -fill x -side left pack .listbar.outputs -expand false -fill x -side left pack .listbar.sort -expand false -fill x -side right # side bar canvas .plotbar tk_optionMenu .plotbar.select select "Select X" "Select Y" "Select Z" tk_optionMenu .plotbar.dim dimension "2D" "3D" tk_optionMenu .plotbar.plot plottype "Single" "Multi" pack .plotbar.dim -expand false -fill x -side right pack .plotbar.plot -expand false -fill x -side right pack .plotbar.select -expand false -fill x -side right # button bar canvas .buttonbar button .buttonbar.newwin -text "New Plot" -relief raised -command { set windownum [expr 1 + \$windownum] puts "set term x11 \$windownum" } pack .buttonbar.newwin -expand false -side right ## parameter list canvas canvas .parameters listbox .parameters.list -background oldlace -foreground black scrollbar .parameters.yscrollbar -orient v ## configure scrollbars .parameters.yscrollbar configure -command ".parameters.list yview" .parameters.list configure -yscrollcommand ".parameters.yscrollbar set" ## bind lists bind .parameters.list <<ListboxSelect>> { set parameter [ .parameters.list get anchor ] plot \$parameter set select "Select Y" } proc "reverse_name" "name" { set delim "_" set split_name [split \$name \$delim] set reversed_name [lindex \$split_name 0] for {set i 1} {\$i<[llength \$split_name]} {incr i} { set reversed_name [lindex \$split_name \$i]\$delim\$reversed_name |
︙ | ︙ | |||
141 142 143 144 145 146 147 | } EOF ## create states and outputs lists gawk ' ($1 == "state") { | | | > > | > > > > > > > > > > > > > > > | | | < | | | < | | > > > > > > > > > > | > > > > | > > | > > > > > > | > | < | > > > > > > > > > > > > > | < > | | > | > > | > > > | > | > > > | > | | | > | | > | < > | | | > | 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 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | } EOF ## create states and outputs lists gawk ' ($1 == "state") { printf "lappend xl %s\n", $4 } ($1 == "output") { printf "lappend yl %s\n", $4 }' ${struc} >> ${out} cat <<EOF >> ${out} lappend xl Time lappend yl Time .parameters.list configure -listvar yl pack .menubar -expand false -fill x -side top pack .plotbar -expand false -fill x -side bottom pack .listbar -expand false -fill x -side top pack .buttonbar -expand false -fill x -side bottom pack .parameters.yscrollbar -expand false -fill y -side right pack .parameters.list -expand true -fill both -side left pack .parameters -expand true -fill both ## map names to column numbers proc "get_state_column" "title" { EOF gawk ' ($1 == "state") { printf "if (\"%s\"==\"%s\") { return %d }\n", Title, $4, $2+2+Ny; } ' Title=\$title Ny=${Ny} ${struc} >> ${out} cat <<EOF >> ${out} } proc "get_output_column" "title" { EOF gawk ' ($1 == "output") { printf "if (\"%s\"==\"%s\") { return %d }\n", Title, $4, $2+1; } ' Title=\$title Ny=${Ny} ${struc} >> ${out} cat <<EOF >> ${out} } proc "plot" "title" { global select global view global xcolumn global ycolumn global zcolumn global xtitle global ytitle global ztitle if {"\$title" == "Time"} { set column 1 } elseif {"\$view" == "states"} { set column [get_state_column \$title] } elseif {"\$view" == "outputs"} { set column [get_output_column \$title] } if {"\$select" == "Select X"} { set xcolumn \$column set xtitle \$title } elseif {"\$select" == "Select Y"} { set ycolumn \$column set ytitle \$title } elseif {"\$select" == "Select Z"} { set zcolumn \$column set ztitle \$title } plot_var } ## call gnuplot proc "plot_var" "" { global xcolumn global ycolumn global zcolumn global xtitle global ytitle global ztitle global dimension global plottype global lastplot if {"\$dimension" == "2D"} { if {"\$plottype" == "Single"} { puts "set xlabel '\$xtitle'" puts "set ylabel '\$ytitle'" puts "set nokey" puts "plot '${dat2}' using \$xcolumn:\$ycolumn title 'y:\$ytitle x:\$xtitle' with lines" } elseif {"\$plottype" == "Multi"} { puts "set xlabel ''" puts "set ylabel ''" puts "set key" if {"\$lastplot" != "2D"} { puts "plot '${dat2}' using \$xcolumn:\$ycolumn title 'y:\$ytitle x:\$xtitle' with lines" } else { puts "replot '${dat2}' using \$xcolumn:\$ycolumn title 'y:\$ytitle x:\$xtitle' with lines" } } set lastplot "2D" } elseif {"\$dimension" == "3D"} { if {"\$plottype" == "Single"} { puts "set xlabel '\$xtitle'" puts "set ylabel '\$ytitle'" puts "set zlabel '\$ztitle'" puts "set nokey" puts "splot '${dat2}' using \$xcolumn:\$ycolumn:\$zcolumn title 'z:\$ztitle y:\$ytitle x:\$xtitle' with lines" } elseif {"\$plottype" == "Multi"} { puts "set xlabel ''" puts "set ylabel ''" puts "set zlabel ''" puts "set key" if {"\$lastplot" != "3D"} { puts "splot '${dat2}' using \$xcolumn:\$ycolumn:\$zcolumn title 'z:\$ztitle y:\$ytitle x:\$xtitle' with lines" } else { puts "replot '${dat2}' using \$xcolumn:\$ycolumn:\$zcolumn title 'z:\$ztitle y:\$ytitle x:\$xtitle' with lines" } } set lastplot "3D" } } ## open gnuplot plot file proc "open_plotfile" "" { global parameter if {"\$parameter"==""} { set name "${sys}.plt" |
︙ | ︙ | |||
265 266 267 268 269 270 271 | puts "replot" tk_dialog ".printed" "Graph Printed!" "PostScript saved as \$filename" "" "0" "Close" } } } # Defaults | > > > > > > > > > | | | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | puts "replot" tk_dialog ".printed" "Graph Printed!" "PostScript saved as \$filename" "" "0" "Close" } } } # Defaults set parameter "" set windownum 0 set view outputs set lastplot "" set select "Select Y" set xcolumn 1 ; set xtitle "Time" set ycolumn 1 ; set ytitle "Time" set zcolumn 1 ; set ztitle "Time" puts "set grid" puts "set nopolar" puts "set term X11 0" puts "set key" EOF chmod +x ${out} |