Diagram

class feynman.diagrams.diagrams.Diagram(ax=None, xy0=(0.0, 0.0), **kwargs)

The main object for a feynman diagram.

Parameters:
  • ax – A matplotlib.axes.AxesSubplot instance. If no ax is given, a new figure and a new axe are initialized.
  • xy0 – Default reference point for creation of vertices.
  • transparent – Set the background as transparent.
add_line(line)

Add a feynman.Line instance.

add_operator(operator)

Add an feynman.Operator instance.

add_vertex(vertex)

Add a feynman.Vertex instance.

line(*args, **kwargs)

Create a feynman.Line instance.

operator(*args, **kwargs)

Create an feynman.Operator instance.

scale(x)

Apply a scaling factor to the diagram. Suppose your diagram looks good for a figure of size (6,6) with a single subplot. If you create multiple subplots in your figure, each with its own diagram (e.g. to represent an equation), then the same diagram will generally look too thick in the smaller subplots. It is then desirable to apply a scaling factor to thin down the lines, the arrows, and the text for all objects of the diagram.

text(*args, **kwargs)

Add text using matplotlib.axes.Axes.text.

vertex(xy='auto', **kwargs)

Create a feynman.Vertex vertex.

Parameters:
  • xy – Coordinates of the vertex.
  • **kwargs – Any argument passed to feynman.Vertex
Returns:

Return type:

feynman.Vertex

vertices(xys, **kwargs)

Create multiple vertices.

Parameters:
  • xys – List of xy coordinates.
  • **kwargs – Any matplotlib line style argument.
Returns:

Return type:

list of feynman.Vertex instance.