Line

class feynman.Line(vstart, vend, **kwargs)

A particle line joigning two vertices.

Parameters:
  • vstart – Starting vertex.
  • vend – End vertex.
  • style ('shape flavour stroke') – A single string that specifies the shape, flavour, and stroke, in any order.
  • shape ('linear') –

    The shape determines the line path.

    linear - A straight line between two points.
    elliptic - An ellipse arc.
    circular - A circle starting and ending at the same vertex.
  • flavour ('simple') –

    The type of line.

    simple - A straight line that follows the line path.
    wiggly - A wavy line around the line path..
    loopy - A spring.
  • stroke ('single') –

    The style for the line.

    single - A simple line.
    double - A double line.
  • ellipse_spread (0.5) – The angle (in units of tau) spread by the ellipse arc. The limit cases are | 0.0 –> the curve will tend to a straight ligne, | 0.5 –> the curve will be half an ellipse, | 1.0 –> the curve will tend to a closed ellipse.
  • ellipse_excentricity (1.2) – The excentricity of the ellipse, that is, the ratio of the long axe over the short axe. At 1.0, the curve will be a circle arc. Also Controls wether the curve is ‘up’ or ‘down’. A positive value makes it ‘up’, while a negative value makes it ‘down’.
  • ellipse_position (['up', 1] or ['down', -1]) – In case ellipse_excentricity is not defined:
  • circle_radius (1) – The radius of the circle.
  • circle_angle (0.25) – The angle of the anchor vertex to the circle center, in units of tau.
  • circle_excentricity (1) – The excentricity of the circle. | > 1. –> squeezed in the tangent direction at the anchor point. | < 1. –> stretched in the tangent direction at the anchor point.
  • arrow (True) – Include an arrow in the line.
  • arrow_param (dict) – In case arrow==True, gives a mapping of all parameters for add_arrow.
  • nwiggles (float) – The number of wiggles in a wiggly line. Can be integer or half-integer (if the phase is 0 or .5).
  • nloops (float) – The number of loops in a loopy line.
  • phase (float) – Phase in the wiggly or loopy pattern, in units of tau.
  • npoints (int) – Number of points that makes up the line.
  • **line_kwargs – Keyword arguments for matplotlib.Lines.line2D .
add_arrow(*args, **kwargs)

Add an arrow on the line.

Parameters:
  • style (['normal', 'fancy', 'line']) – ‘normal’ is a triagular arrow. ‘fancy’ is a triangular arrow with a bent back. ‘line’ is a two-stroke line.
  • t (float) – The position of the arrow along the line. Must be in the range [0,1].
  • direction – The direction of the arrow. A positive number gives a forward arrow while a negative number gives a backward arrow.
  • width – The width of the arrow.
  • length – The length of the arrow.
  • t_shift_dir – When the shape of the line is not linear, the direction of the arrow will be given by the tangent of the line at position t + t_shift_dir.
line_kwargs

Style specifications for matplotlib.lines.Line2D such as color, linewidth, etc.

scale(x)

Apply a scaling factor.

scale_arrows(x)

Apply a scaling factor to the arrows size.

scale_text(x)

Apply a scaling factor to the text size and relative position.

scale_width(x)

Apply a scaling factor to the line width.

set_flavour(flavour)

Set the line style.

simple - A straight line.
wiggly - A wavy line.
loopy - A spring.
set_shape(shape)

Set the path type.

linear - A straight line between two points. elliptic - An ellipse arc. circular - A circle starting and ending at the same vertex.
set_stroke(stroke)

Set the stroke.

single - A single line. double - A double line.
set_style(kwargs)

Set at once the shape, flavour and stroke of the line.

text(s, t=0.5, y=-0.06, **kwargs)

Add text over the line.

Parameters:
  • s (Text string.) –
  • t ((5)) – Position along the line (0 < t < 1).
  • y ((-.06)) – y position, perpendicular to the path direction.
  • fontsize – The font size.
  • **kwargs – Any other style specification for a matplotlib.text.Text instance.