File: mgnuplot.in

package info (click to toggle)
maxima 5.10.0-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 44,268 kB
  • ctags: 17,987
  • sloc: lisp: 152,894; fortran: 14,667; perl: 14,204; tcl: 10,103; sh: 3,376; makefile: 2,202; ansic: 471; awk: 7
file content (115 lines) | stat: -rwxr-xr-x 2,816 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
# comment \
exec @WISH@ "$0" "$@"


#set gnuPlotstream [open {|  gnuplot /d19/staff/wfs/tmp/jo } w]
set gnuPlotstream [open {|  gnuplot  } r+]


proc sendgnu com {
    global gnuPlotstream
    puts stdout $com ; flush stdout
    puts $gnuPlotstream $com ; flush $gnuPlotstream
}

set ii 0
while {$ii < $argc} {
 switch -exact "X[lindex $argv $ii]"  {
    X-parametric3d {
    sendgnu "set parametric\n" 
    sendgnu "set data style lines\n"
    sendgnu "set hidden\n"
    set ii [expr {$ii + 1}]
    sendgnu "splot '[lindex $argv $ii]'\n" }
    X-plot2d {
    set ii [expr {$ii + 1}]
    sendgnu "set data style lines"
    sendgnu "plot '[lindex $argv $ii]'\n" 
    }
    X-title {
    set ii [expr {$ii + 1}]
    sendgnu "set title '[lindex $argv $ii]'\n" }
    
    }
    set ii [expr {$ii +1}]
    }
      
set xrot 60
set zrot 30


text .text
.text configure -height 4 -width 40

proc getoptions {} {
#    unlink gnu-optionsxx
    set tmp gnu-optionsxx
    exec rm -f $tmp
    sendgnu "save '$tmp'\n"
    while {[file exists $tmp] <= 0} {exec sleep 0}
    set at [.fra.options nearest 0]
    set f [ open gnu-optionsxx ]
    .fra.options delete 0 end
    while { [gets $f line] >= 0 } {
	.fra.options insert end [lrange $line 0 end ]}
    .fra.options yview $at	
    }

frame .fra -bd 2
label .fra.label -text "Current Set Options"
scrollbar .fra.scroll -command ".fra.options yview"    
listbox .fra.options -yscrollcommand ".fra.scroll set" -relief sunken -bd 2
pack .fra.label
pack .fra.options -side left
pack .fra.scroll -side right -fill y
bind .fra.options <Double-1> "set selected_option  \[lindex \[selection get\] 0\]"
frame .option_edit

proc msg a {global $a
 sendgnu [format "%s\n\nreplot\n" [expr $$a]] ;
 set $a ""
 getoptions}
 
proc mkOption_edit {a b} {
    global $b
   label $a.label -text "Edit: "
   entry $a.entry -width 20 -relief sunken -bd 2 -textvariable $b
    bind $a.entry  <Return> "msg  $b"
   pack $a.label $a.entry -side left -padx 1m -pady 2m
}

mkOption_edit .option_edit selected_option


getoptions

button .exit -text "Exit" -command {
    sendgnu  "exit\n"
    destroy .
}

button .save -text "save gnuplot.out" -command {
    sendgnu "save 'gnuplot.out'\n"
 }

scale .rotxscale -label "xrotation"  \
   -orient horizontal -length 200 -from 0 -to 180 \
    -command gnuPlotsetview -tickinterval 60
scale .rotzscale -label "zrotation" \
    -orient horizontal -length 200 -from 0 -to 360 \
    -command gnuPlotsetview -tickinterval 120

set initted 0
.rotxscale set $xrot
.rotzscale set $zrot

proc gnuPlotsetview value  {
    global initted
    if { $initted < 2 } { set initted [expr {$initted + 1}]} \
    else \
    {sendgnu [format "set view %d,%d\nreplot\n" [.rotxscale get] [.rotzscale get]]}}

pack .exit   .rotxscale .rotzscale .fra .option_edit .save