Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to do 3d line plots

72 views
Skip to first unread message

Richard Owlett

unread,
Jul 18, 2007, 4:32:15 PM7/18/07
to
Basically I wish to plot a path thru 3d space.
I've been looking at Plotchart ( create3DPlot and $plot3d plotdata )
with no luck.

Please point me in right direction. Examples appreciated. Thanks.

Michael Schlenker

unread,
Jul 19, 2007, 5:17:56 PM7/19/07
to
Richard Owlett schrieb:
Plot a path through 3D space sounds like you want something like one of
the OpenGL extensions (e.g. http://www.tcl3d.org).

If its more a thing like GIS pathes you might look at something like
GRASS, which has a Tk based GUI.

Michael

Arjen Markus

unread,
Jul 20, 2007, 2:30:03 AM7/20/07
to

Hm, it should not be too difficult to extend Plotchart
with such a facility, but that would come after my holidays :).

Drop me a note if you are interested in that.

Regards,

Arjen

Richard Owlett

unread,
Jul 20, 2007, 8:01:43 AM7/20/07
to
Michael Schlenker wrote:
> Richard Owlett schrieb:
>
>>Basically I wish to plot a path thru 3d space.
>>I've been looking at Plotchart ( create3DPlot and $plot3d plotdata )
>>with no luck.
>>
>>Please point me in right direction. Examples appreciated. Thanks.
>
> Plot a path through 3D space sounds like you want something like one of
> the OpenGL extensions (e.g. http://www.tcl3d.org).

Thank you for the link. I've only had a chance to look at the opengl
samples -- I've heard of it before. Typical of the problems I run into,
it seems to be simultaneously too much _AND_ too little. Their audience
is heavily orientated towards rendering 3D solids (with *IMPRESSIVE*
results). But I want at most *A* 3 dimensional line. I have also been
mulling the idea of a 3D scatter plot.

In another thread, someone was referred to Tkzinc. That appears to have
the same difficulty from my perspective.

I may revert to using Scilab for my plotting. Originally I was refferred
to TclTk to simplify data gathering. It turned out it could handle my
minimal data reduction chores. If I could master Plotchart, all could be
done in TclTk.

>
> If its more a thing like GIS pathes you might look at something like
> GRASS, which has a Tk based GUI.

No, that's not related to my interests.

Uwe Klein

unread,
Jul 20, 2007, 9:03:34 AM7/20/07
to
Hey,
I've never tried this but

gnuplot has a variety of 3d modes.

_and_

gnuplot can do output to a tcl canvas.

gnuplot:
http://www.gnuplot.info/

G!
uwe

Richard Owlett

unread,
Jul 20, 2007, 10:09:53 AM7/20/07
to
Arjen Markus wrote:

Thank you. It was your page, http://wiki.tcl.tk/18167 , which was
tantalizing me ;) I'm newbie enough to not know how to follow up on
"They are all part of the CVS repository, so for the most recent
versions, I will refer you to the Tklib project."

I'm looking for the 3D equivalent of createXYPlot and related commands.

Richard Owlett

unread,
Jul 20, 2007, 1:58:56 PM7/20/07
to
Richard Owlett wrote:

> Arjen Markus said:
>
> You will need to get a recent version of Plotchart - from the CVS
> repository - see the receipes on the site or by downloading the
> sources one by one.
>
> I am confident people on the comp.lang.tcl newsgroup can help you
> with retrieving and installing Tklib.

I am completely lost. I have never used CVS.

I managed to download the scrip[t that generates the samples shown on
http://wiki.tcl.tk/18167 . That was as far as I could get.

Thank you.

Richard Owlett

unread,
Jul 22, 2007, 7:27:35 AM7/22/07
to

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.

Uwe Klein

unread,
Jul 22, 2007, 1:30:58 PM7/22/07
to
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



Richard Owlett

unread,
Jul 22, 2007, 4:51:37 PM7/22/07
to

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.

Uwe Klein

unread,
Jul 23, 2007, 2:05:56 AM7/23/07
to
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


suchenwi

unread,
Jul 23, 2007, 4:22:39 AM7/23/07
to
On 22 Jul., 22:51, Richard Owlett <rowl...@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...


Esa Heikkinen

unread,
Jul 23, 2007, 5:50:03 AM7/23/07
to
Richard Owlett kirjoitti:

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

Richard Owlett

unread,
Jul 23, 2007, 8:17:06 AM7/23/07
to


Printing $canvcmds gave a blank line until I changed


set canvcmds [ exec "G:\\gnuplot\\bin\\pgnuplot" << $gpcmds ]

to


set canvcmds { exec "G:\\gnuplot\\bin\\pgnuplot" << $gpcmds }

It still doesn't work. Has anyone else attempted to do this on a
Windows(tm) system. I notice that the help file lists many cautions
about using exec on Windows(tm) systems.

suchenwi

unread,
Jul 23, 2007, 9:01:01 AM7/23/07
to
On 23 Jul., 14:17, Richard Owlett <rowl...@atlascomm.net> wrote:

> Printing $canvcmds gave a blank line until I changed
> set canvcmds [ exec "G:\\gnuplot\\bin\\pgnuplot" << $gpcmds ]
> to
> set canvcmds { exec "G:\\gnuplot\\bin\\pgnuplot" << $gpcmds }
>

That does something very differently, and probably not the thing
wanted.

> It still doesn't work. Has anyone else attempted to do this on a
> Windows(tm) system. I notice that the help file lists many cautions

> about using exec on Windows(tm) systems.-

I just downloaded, on a Win XP box,
http://gnuplot.sourceforge.net/development/binaries/gp41-July18_2006-winbin.zip

and can confirm that the exec for that particular pgnuplot.exe returns
"".

Uwe Klein

unread,
Jul 27, 2007, 5:48:04 AM7/27/07
to
No, and yes it is.

you [exec] gnuplot with the commands of your choice.
In this case you advise gnuplot to use its "tkcanvas" driver
for output.
( Tcl as in Tool Control Language ;-)

The output is a script that creates three procs.
[gnuplot] containing all the commands to create your plot as
elements on a tkcanvas. ( see prev posting for details )

[gnuplot_plotarea] to know about the bbox

and
[gnuplot_axisranges] to know about used and plotted
axis ranges.

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
}


>
>
> ---
> Esa
uwe

0 new messages