Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Riccardo Campana <riccardo.campana@un...>  20061204 16:56:27

Hello, I plotted the points from a data file, e.g.: 0.194 0.854 0.451 0.907 0.660 0.124 0.834 0.195 0.022 0.911 0.055 0.216 0.275 0.704 0.311 0.554 0.641 0.687 0.386 0.543 with the standard command g = graph.graphxy(width=8,height=8) g.plot(graph.data.file("datafile.dat", x=1, y=2), [graph.style.symbol (graph.style.symbol.circle, size=0.1, symbolattrs=[deco.filled])]) Now, I want to draw a straight line between some of these points, for example from the point (0.194, 0.854) to the point (0.311, 0.554). How can I do this? With path.line() and stroke() the points are not in graph (axis) coordinates... Thank you in advance, Riccardo Campana 
From: Andre Wobst <wobsta@us...>  20061204 17:35:30

Hi, On 04.12.06, Riccardo Campana wrote: > Hello, > I plotted the points from a data file, e.g.: > 0.194 0.854 > 0.451 0.907 > 0.660 0.124 > 0.834 0.195 > 0.022 0.911 > 0.055 0.216 > 0.275 0.704 > 0.311 0.554 > 0.641 0.687 > 0.386 0.543 > > with the standard command > g = graph.graphxy(width=8,height=8) > g.plot(graph.data.file("datafile.dat", x=1, y=2), [graph.style.symbol > (graph.style.symbol.circle, size=0.1, symbolattrs=[deco.filled])]) > > Now, I want to draw a straight line between some of these points, for > example from the point (0.194, 0.854) to the point (0.311, 0.554). > > How can I do this? With path.line() and stroke() the points are not > in graph (axis) coordinates... You're absolutely right. Fortunately we already thought about this and created some handy conversion methods, which are part of the graph infrastructure. The only thing you need to understand is that you need to "finish" the graph (i.e. fix the layout) before you can start using those conversion methods. Before finishing the graph the axis ranges are not fixed ... So all you need to do is to call "g.finish()" after you plot commands. (Actually a g.dolayout() would already be enough.) Then you can convert points from axis coordinates to PyX lengths in the graph "canvas" by g.pos(): x1, y1 = g.pos(0.194, 0.854) x2, y2 = g.pos(0.311, 0.554) And than: g.stroke(path.line(x1, y1, x2, y2)) (I haven't checked the code but it should work along this line.) HTH, André  by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX  High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ 
From: <mschindler@us...>  20061204 17:45:43

Hello, On 04.12.06, Riccardo Campana wrote: > Hello, >=20 > with the standard command > g =3D graph.graphxy(width=3D8,height=3D8) > g.plot(graph.data.file("datafile.dat", x=3D1, y=3D2), [graph.style.symb= ol=20 > (graph.style.symbol.circle, size=3D0.1, symbolattrs=3D[deco.filled])]) >=20 > Now, I want to draw a straight line between some of these points, for =20 > example from the point (0.194, 0.854) to the point (0.311, 0.554). >=20 > How can I do this? With path.line() and stroke() the points are not =20 > in graph (axis) coordinates... draw the lines directly on g which is a canvas. g.pos allows you to convert graphcoordinates into lengths g.finish() x1, y1 =3D g.pos(0.194, 0.854) x2, y2 =3D g.pos(0.311, 0.554) g.stroke(path.line(x1, y1, x2, y2)) If you want lines between all the points, just say instead in your plot command graph.style.line() in addition to graph.style.symbol(...) Michael. =20 "A mathematician is a device for turning coffee into theorems" Paul Erd=F6s. 
Sign up for the SourceForge newsletter:
No, thanks