|
[PyFeyn] PyFeyn adjust fontsGeorg von Hippel hippel at uni-mainz.deTue Nov 15 15:15:53 GMT 2016
Hi Ian, to draw on an existing canvas, you can initiate a FeynDiagram instance drawing to that canvas by passing the canvas to the FeynDiagram constructor as in fd = FeynDiagram(canvas=my_preexisting_canvas) and then draw to that canvas using my_canvas_that_has_now_been_drawn_on = fd.drawToCanvas() which is exactly what the draw method does internally before writing the resulting canvas to a file. The interface to add text attributes to LineLabel objects isn't currently exposed, so unless you want to start fiddling with PyFeyn internals, you'd have to stick to using LaTeX commands; adding \color{green} to the TeX code in addLabel should work, as long as you call pyx.text.defaulttexrunner.preamble(r"\usepackage{xcolor}") before any other commands. (You can also add lines defining your own custom colours to the preamble, and then use those). Best, Georg On Tue, 15 Nov 2016, Ian Brock wrote: > Hi Georg, > > Thanks for the information. I am still finding my way around this stuff. > > Suppose I want a green electron line and the label to be also green. For now I do: > fa2 = Fermion(vtx1, out1).addArrow().addLabel(r'$\Pe(k^{\prime})$') > fa2.setStyles([FORESTGREEN]) > However, how can I get \Pe to also be green? > I am not sure how to change the pyx.text.defaulttexrunner attributes or where I can find documentation on that. > > Another question: Can I draw the diagram on a canvas rather than directly into a file? I see there is a command drawToCanvas(), bit I am not sure if I have to initialise the canvas and if so how? > > Best Regards > Ian > > Ian C. Brock | Physikalisches Institut, Universität Bonn | Nußallee 12 | D-53115 Bonn > Tel. +49 228 733616 | Email: brock at physik.uni-bonn.de <mailto:brock at physik.uni-bonn.de> -- =========================================================================== PD Dr. Georg von Hippel Institut für Kernphysik Office: 2-100 Johannes Gutenberg-Universität Mainz Phone: +49 6131 39-22933 Johann-Joachim-Becher-Weg 45 Fax: +49 6131 39-22964 55099 Mainz Email: hippel at uni-mainz.de Germany wwwth.kph.uni-mainz.de/1205.php ===========================================================================
More information about the PyFeyn mailing list |