Show ellements of Feynman diagrams
Source code name: "canvas_diagram1.py"
Programming language: Python
Topic: Physics/HEP
DMelt Version 1. Last modified: 05/09/2015. License: Free
https://datamelt.org/code/cache/canvas_diagram1_4539.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



from java.awt import *
from jhplot import *
from jhplot.jadraw import Diagram

c1=HPlotJa("Canvas",600,400,1,1,0)
c1.setGTitle("Feynman Diagram objects", Color.blue)
c1.visible()
c1.showEditor(1)   # show diagram editor
gl=Diagram.Box(0.1,0.1) # box
gl.setRelWH(0.05,0.05,"NDC")
c1.add(gl)
gl=Diagram.Blob(0.1,0.2) # blob
gl.setRelWH(0.01,0.01,"NDC")
c1.add(gl)
gl=Diagram.Vertex(0, 0.1,0.3) # a vertex
gl.setRelWH(0.01,0.01,"NDC")
c1.add(gl)
gl=Diagram.GLine(0.1,0.4)     # gluon line
gl.setStroke(2)
gl.setRelWH(0.1,0.2,"NDC")
c1.add(gl)
gl=Diagram.PLine(0.4,0.1)     # gluon line
gl.setStroke(2)
gl.setRelWH(0.1,0.2,"NDC")
c1.add(gl)
gl=Diagram.FLine(0.4,0.3)     # gluon line
gl.setStroke(2)
gl.setRelWH(0.1,0.2,"NDC")
c1.add(gl)


c1.update()