line

Easiest way to create lines in svg rather than using the :py:mod:beampy.svg.

from beampy import *

# Remove quiet=True to get Beampy render outputs
doc = document(quiet=True)

with slide('Svg: Line'):
    line(800-20, 600-50, x=20, y=50, color='red')
    hline(300, color='orange', linewidth='4px')
    vline(400, color='crimson', linewidth='10px', opacity=0.5)

display_matplotlib(gcs())
../_images/sphx_glr_plot_line_001.png

Module arguments

class beampy.line(x2, y2, **kwargs)

Insert an svg line.

Parameters:
  • x2 (int or float or str) – End horizontal coordinate of the line. The value is passed to unit converted of Beampy which translate it to pixel.
  • y2 (int or float or str) – End vertical coordinate of the line. The value is passed to unit converted of Beampy which translate it to pixel.
  • x (int or float or {'center', 'auto'} or str, optional) – Horizontal position for the line (the default theme sets this to ‘center’). See positioning system of Beampy.
  • y (int or float or {'center', 'auto'} or str, optional) – Vertical position for the line (the default theme sets this to ‘auto’). See positioning system of Beampy.
  • linewidth (string, optional) – Line width (the default theme sets this to ‘2px’). The value is given as string followed by an unit accepted by svg syntax.
  • color (string, optional) – Line color (the default theme sets this to THEME[‘title’][‘color’]). The color is given either as HTML hex value “#ffffff” or as svg colornames “blank”.
  • opacity (float, optional) – Opacity of the rectangle (the default theme sets this to 1). The value ranges between 0 (transparent) and 1 (solid).
beampy.hline(y, **kwargs)

Create an horizontal line at a given horizontal position. Accept all arguments of beampy.line

Parameters:y (int or float or {'center', 'auto'} or str) – Vertical position for the line (the default theme sets this to ‘auto’). See positioning system of Beampy.

See also

beampy.line

beampy.vline(x, **kwargs)

Create an horizontal line at a given vertical position. Accept all arguments of beampy.line

Parameters:x (int or float or {'center', 'auto'} or str) – Horizontal position for the line (the default theme sets this to ‘auto’). See positioning system of Beampy.

See also

beampy.line

Gallery generated by Sphinx-Gallery