From: Uwe Klein on
Richard Owlett wrote:

> I've downloaded a current version of gnuplot and it plots my data
> nicely. I didn't find a interface to Tcl however.[except one that will
> continuously rotate the plot thru various views]. My OS is WinXP.
>

gnuplot has a terminal driver for the Tk canvas.

in a tcl shell do

#start
package require Tk

set gpcmds "
set terminal tkcanvas
plot sin(x)
"

set canvcmds [ exec gnuplot << $gpcmds ]

eval $canvcmds

canvas .c ; pack .c

gnuplot .c

#end

G!
uwe





From: Richard Owlett on
Uwe Klein wrote:
> Richard Owlett wrote:
>
>> I've downloaded a current version of gnuplot and it plots my data
>> nicely. I didn't find a interface to Tcl however.[except one that will
>> continuously rotate the plot thru various views]. My OS is WinXP.
>>
>
> gnuplot has a terminal driver for the Tk canvas.
>
> in a tcl shell do
>
> #start
> package require Tk
>
> set gpcmds "
> set terminal tkcanvas
> plot sin(x)
> "
>
> set canvcmds [ exec gnuplot << $gpcmds ]
>
> eval $canvcmds
>
> canvas .c ; pack .c
>
> gnuplot .c
>
> #end
>

I had to modify the code to reflect path to executable and its name.

package require Tk
set gpcmds "
set terminal tkcanvas
plot sin(x)
"
set canvcmds [ exec "G:\\gnuplot\\bin\\pgnuplot" << $gpcmds ]
eval $canvcmds
canvas .c ; pack .c
pgnuplot .c

In response to the last line I receive

invalid command name "gnuplot"


What is my problem?
I am using ActiveStates distribution under WinXP Pro SP2.

From: Uwe Klein on
Richard Owlett wrote:
> Uwe Klein wrote:
>
>> Richard Owlett wrote:
>>
>>> I've downloaded a current version of gnuplot and it plots my data
>>> nicely. I didn't find a interface to Tcl however.[except one that
>>> will continuously rotate the plot thru various views]. My OS is WinXP.
>>>
>>
>> gnuplot has a terminal driver for the Tk canvas.
>>
>> in a tcl shell do
>>
>> #start
>> package require Tk
>>
>> set gpcmds "
>> set terminal tkcanvas
>> plot sin(x)
>> "
>>
>> set canvcmds [ exec gnuplot << $gpcmds ]
>>
>> eval $canvcmds
>>
>> canvas .c ; pack .c
>>
>> gnuplot .c
>>
>> #end
>>
>
> I had to modify the code to reflect path to executable and its name.
>
> package require Tk
> set gpcmds "
> set terminal tkcanvas
> plot sin(x)
> "
> set canvcmds [ exec "G:\\gnuplot\\bin\\pgnuplot" << $gpcmds ]
> eval $canvcmds
> canvas .c ; pack .c
> pgnuplot .c
>
> In response to the last line I receive
>
> invalid command name "gnuplot"
>
>
> What is my problem?
> I am using ActiveStates distribution under WinXP Pro SP2.
>
print the content of $canvcmds to the screen or a printer
the gnuplot output is essentially a script that defines
a couple of procs.

proc gnuplot can {
.....................
# lots of [expr] and
# [$can create ...] stuff
}
proc gnuplot_plotarea {} {
...........
# returns the bbbox of the plot
}
proc gnuplot_axisranges {} {
..............
# returns the x and y scale range and the actual used range
}

either you made some typing mistake or the [eval] went astray.

uwe


From: suchenwi on
On 22 Jul., 22:51, Richard Owlett <rowl...(a)atlascomm.net> wrote:

> I had to modify the code to reflect path to executable and its name.
>
> package require Tk
> set gpcmds "
> set terminal tkcanvas
> plot sin(x)
> "
> set canvcmds [ exec "G:\\gnuplot\\bin\\pgnuplot" << $gpcmds ]
> eval $canvcmds
> canvas .c ; pack .c
> pgnuplot .c
>
> In response to the last line I receive
>
> invalid command name "gnuplot"
>
> What is my problem?
> I am using ActiveStates distribution under WinXP Pro SP2

I'd first just add
puts $canvcmds
after the exec line, to see what is in it. From context I guess that
it should define a proc named gnuplot...


From: Esa Heikkinen on
Richard Owlett kirjoitti:
> Uwe Klein wrote:
>> Richard Owlett wrote:
>>
>>> I've downloaded a current version of gnuplot and it plots my data
>>> nicely. I didn't find a interface to Tcl however.[except one that
>>> will continuously rotate the plot thru various views]. My OS is WinXP.
>>>
>>
>> gnuplot has a terminal driver for the Tk canvas.
>>
>> in a tcl shell do
>>
>> #start
>> package require Tk
>>
>> set gpcmds "
>> set terminal tkcanvas
>> plot sin(x)
>> "
>>
>> set canvcmds [ exec gnuplot << $gpcmds ]
>>
>> eval $canvcmds
>>
>> canvas .c ; pack .c
>>
>> gnuplot .c
>>
>> #end
>>
>
> I had to modify the code to reflect path to executable and its name.
>
> package require Tk
> set gpcmds "
> set terminal tkcanvas
> plot sin(x)
> "
> set canvcmds [ exec "G:\\gnuplot\\bin\\pgnuplot" << $gpcmds ]
> eval $canvcmds
> canvas .c ; pack .c
> pgnuplot .c
>
> In response to the last line I receive
>
> invalid command name "gnuplot"
>
>
> What is my problem?
> I am using ActiveStates distribution under WinXP Pro SP2.
>

Hi

I am little surprised. Is it really possible to run gnuplot inside TCL
in canvas ? I was thinking the gnuplot was only "external" program.


---
Esa
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: Need help on tablelist
Next: TCL exec