## [PyX-user] labelling connectors

 [PyX-user] labelling connectors From: andrea valle - 2006-07-26 00:26:01 ```Hi to all, I'm a ConTeXt user but also a Python user, so I prefer PyX to Metapost. As a newbie, I started generating drawings for the a series of books.=20= Nice. I'd like to plot a series of graphs, in which edges are given a certain=20= weight. How can I label edges in a simple way? Is there an attribute of=20= connectors letting specify a label? It would be nice. Thanks a lot Best -a- Andrea Valle DAMS - Facolt=E0 di Scienze della Formazione Universit=E0 degli Studi di Torino http://www.semiotiche.it/andrea andrea.valle@...= ```

 [PyX-user] labelling connectors From: andrea valle - 2006-07-26 00:26:01 ```Hi to all, I'm a ConTeXt user but also a Python user, so I prefer PyX to Metapost. As a newbie, I started generating drawings for the a series of books.=20= Nice. I'd like to plot a series of graphs, in which edges are given a certain=20= weight. How can I label edges in a simple way? Is there an attribute of=20= connectors letting specify a label? It would be nice. Thanks a lot Best -a- Andrea Valle DAMS - Facolt=E0 di Scienze della Formazione Universit=E0 degli Studi di Torino http://www.semiotiche.it/andrea andrea.valle@...= ```
 Re: [PyX-user] labelling connectors From: Andre Wobst - 2006-07-26 11:34:43 ```Hi Andrea, On 25.07.06, andrea valle wrote: > I'm a ConTeXt user but also a Python user, so I prefer PyX to Metapost. > As a newbie, I started generating drawings for the a series of books. > Nice. > > > I'd like to plot a series of graphs, in which edges are given a certain > weight. How can I label edges in a simple way? Is there an attribute of > connectors letting specify a label? > It would be nice. That's what decorators are for. The help us to not always implement the same thing all over the place. You can do: c.stroke(p, [deco.text("hello, world!")]) for any given path. As far as I can see, there are docs missing for the decorators. We really need to cover those features in the docs as well. Still, for the moment you may have a look to the deco module to see the options of this decorator are. It should be straight forward to understand. 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/ ```
 Re: [PyX-user] labelling connectors From: Joerg Lehmann - 2006-07-26 11:36:15 ```Hi Andrea, On 25.07.06, andrea valle wrote: > I'd like to plot a series of graphs, in which edges are given a certain > weight. How can I label edges in a simple way? Is there an attribute of > connectors letting specify a label? Yes, there is the new text decorator (although it doesn't seem to be documented). A simple example is attached. HTH, Jörg from pyx import * c = canvas.canvas() b1 = box.rect(0, 0, 1, 1, relcenter=[0.5, 0.5]) b2 = box.rect(4, 2, 1, 1, relcenter=[0.5, 0.5]) c.stroke(connector.arc(b1, b2), [deco.text("P", angle=90)]) c.writeEPSfile('test') ```
 Re: [PyX-user] labelling connectors From: andrea valle - 2006-07-26 22:07:35 ```Andre, Joerg, thanks a lot. (I suspect I will come back soon with other questions...) Best -a- On 26 Jul 2006, at 11:20, Joerg Lehmann wrote: > Hi Andrea, > > On 25.07.06, andrea valle wrote: >> I'd like to plot a series of graphs, in which edges are given a =20 >> certain >> weight. How can I label edges in a simple way? Is there an attribute =20= >> of >> connectors letting specify a label? > > Yes, there is the new text decorator (although it doesn't seem to be > documented). A simple example is attached. > > HTH, > > J=F6rg > > from pyx import * > > c =3D canvas.canvas() > > b1 =3D box.rect(0, 0, 1, 1, relcenter=3D[0.5, 0.5]) > b2 =3D box.rect(4, 2, 1, 1, relcenter=3D[0.5, 0.5]) > > c.stroke(connector.arc(b1, b2), [deco.text("P", angle=3D90)]) > > c.writeEPSfile('test') > > > = -----------------------------------------------------------------------=20= > -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to =20 > share your > opinions on IT & business topics through brief surveys -- and earn = cash > http://www.techsay.com/default.php?=20 > page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user > > Andrea Valle DAMS - Facolt=E0 di Scienze della Formazione Universit=E0 degli Studi di Torino http://www.semiotiche.it/andrea andrea.valle@... ```
 Re: [PyX-user] labelling connectors From: andrea valle - 2006-07-27 19:10:13 ```Hi Andre, Joerg In the following example On 26 Jul 2006, at 11:20, Joerg Lehmann wrote: > > > from pyx import * > > c =3D canvas.canvas() > > b1 =3D box.rect(0, 0, 1, 1, relcenter=3D[0.5, 0.5]) > b2 =3D box.rect(4, 2, 1, 1, relcenter=3D[0.5, 0.5]) > > c.stroke(connector.arc(b1, b2), [deco.text("P", angle=3D90)]) > > c.writeEPSfile('test') > > How do I change font size for deco.text? I guess it's obvious but can't =20= figure out Many thanks -a- > = -----------------------------------------------------------------------=20= > -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to =20 > share your > opinions on IT & business topics through brief surveys -- and earn = cash > http://www.techsay.com/default.php?=20 > page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user > > Andrea Valle DAMS - Facolt=E0 di Scienze della Formazione Universit=E0 degli Studi di Torino http://www.semiotiche.it/andrea andrea.valle@... ```
 Re: [PyX-user] labelling connectors From: andrea valle - 2006-07-27 20:45:29 ```Auto-solved using textattrs =3D [text.size.Huge] How can I set an arbitrary size? e.g. textattrs =3D [text.size(10)] Thanks -a- On 27 Jul 2006, at 21:09, andrea valle wrote: > Hi Andre, Joerg > > In the following example > > On 26 Jul 2006, at 11:20, Joerg Lehmann wrote: >> >> >> from pyx import * >> >> c =3D canvas.canvas() >> >> b1 =3D box.rect(0, 0, 1, 1, relcenter=3D[0.5, 0.5]) >> b2 =3D box.rect(4, 2, 1, 1, relcenter=3D[0.5, 0.5]) >> >> c.stroke(connector.arc(b1, b2), [deco.text("P", angle=3D90)]) >> >> c.writeEPSfile('test') >> >> > > How do I change font size for deco.text? I guess it's obvious but = can't > figure out > > Many thanks > > -a- > > > > > >> = ----------------------------------------------------------------------=20= >> - >> -- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to >> share your >> opinions on IT & business topics through brief surveys -- and earn =20= >> cash >> http://www.techsay.com/default.php? >> page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV >> _______________________________________________ >> PyX-user mailing list >> PyX-user@... >> https://lists.sourceforge.net/lists/listinfo/pyx-user >> >> > Andrea Valle > DAMS - Facolt=E0 di Scienze della Formazione > Universit=E0 degli Studi di Torino > http://www.semiotiche.it/andrea > andrea.valle@... > > > = -----------------------------------------------------------------------=20= > -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to =20 > share your > opinions on IT & business topics through brief surveys -- and earn = cash > http://www.techsay.com/default.php?=20 > page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user > > Andrea Valle DAMS - Facolt=E0 di Scienze della Formazione Universit=E0 degli Studi di Torino http://www.semiotiche.it/andrea andrea.valle@... ```
 Re: [PyX-user] labelling connectors From: Andre Wobst - 2006-07-28 06:24:49 ```Hi, On 27.07.06, andrea valle wrote: > Auto-solved using > > textattrs = [text.size.Huge] > > How can I set an arbitrary size? e.g. textattrs = [text.size(10)] text.size(number) is just a shortcut to the named sizes. Still, the non-continuous and limited size range of LaTeX applies. (PyX creates a similar set of sizes for TeX as well such that you can use the same size selections in TeX as in LaTeX mode.) So you could modify the font size as you would do in TeX (or LaTeX). Alternatively you can use the PyX units to scale all text by unit.set(xscale=10) in the beginning of your script. Note that this leads to just scaling all the text instead of using the proper font design sizes as it was intended by Knuth to do. Furthermore you can apply transformations within PyX. This can also be used to alter the text size. For example: from pyx import * c = canvas.canvas() c.text(0, 0, "Hello, world!", [trafo.scale(10)]) c.writeEPSfile("hello") 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/ ```
 Re: [PyX-user] labelling connectors From: andrea valle - 2006-07-28 08:01:54 ```Thanks Andre, Totally exhaustive Best -a- On 28 Jul 2006, at 08:24, Andre Wobst wrote: > Hi, > > On 27.07.06, andrea valle wrote: >> Auto-solved using >> >> textattrs =3D [text.size.Huge] >> >> How can I set an arbitrary size? e.g. textattrs =3D [text.size(10)] > > text.size(number) is just a shortcut to the named sizes. Still, the > non-continuous and limited size range of LaTeX applies. (PyX creates a > similar set of sizes for TeX as well such that you can use the same > size selections in TeX as in LaTeX mode.) > > So you could modify the font size as you would do in TeX (or LaTeX). > > Alternatively you can use the PyX units to scale all text by > unit.set(xscale=3D10) in the beginning of your script. Note that this > leads to just scaling all the text instead of using the proper font > design sizes as it was intended by Knuth to do. > > Furthermore you can apply transformations within PyX. This can also be > used to alter the text size. For example: > > from pyx import * > c =3D canvas.canvas() > c.text(0, 0, "Hello, world!", [trafo.scale(10)]) > c.writeEPSfile("hello") > > HTH, > > > Andr=E9 > > -- =20 > by _ _ _ Dr. Andr=E9 Wobst > / \ \ / ) wobsta@..., http://www.wobsta.de/ > / _ \ \/\/ / PyX - High quality PostScript and PDF figures > (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ > > = -----------------------------------------------------------------------=20= > -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to =20 > share your > opinions on IT & business topics through brief surveys -- and earn = cash > http://www.techsay.com/default.php?=20 > page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user > > Andrea Valle DAMS - Facolt=E0 di Scienze della Formazione Universit=E0 degli Studi di Torino http://www.semiotiche.it/andrea andrea.valle@... ```