rectangle

Easiest way to create rectangle 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: rectangle'):
    rectangle(width=300, height=300, y='center')
    rectangle(width=100, height=100, color='yellow', y='center',
              edgecolor='red')

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

Module arguments

class beampy.rectangle(**kwargs)

Insert an svg rectangle.

Parameters:
  • x (int or float or {'center', 'auto'} or str, optional) – Horizontal position for the rectangle (the default is ‘center’). See positioning system of Beampy.
  • y (int or float or {'center', 'auto'} or str, optional) – Vertical position for the rectangle (the default theme sets this to ‘auto’). See positioning system of Beampy.
  • height (string, optional) – Height of the rectangle (the default theme sets this to ‘10px’). The value is given as string with a unit accepted by svg syntax.
  • width (string, optional) – Width of the rectangle (the default theme sets this to document._width). The value is given as string with a unit accepted by svg syntax.
  • color (string, optional) – Color filling the rectangle (the default theme sets this to THEME[‘title’][‘color’]). The color is given either as HTML hex value “#ffffff” or as svg colornames “blank”.
  • linewidth (string, optional) – Rectangle edge line width (the default theme sets this to ‘2px’). The value is given as string followed by an unit accepted by svg syntax.
  • edgecolor (string, optional) – Color of the rectangle edge (the default theme sets this to THEME[‘text’][‘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).
  • rx (int, optional) – The number of pixels for the rounding the rectangle corners in x direction (The default theme sets this value to 0).
  • ry (int, optional) – The number of pixels for the rounding the rectangle corners in y direction (The default theme sets this value to 0).
  • svgfilter (string or None, optional) – Set the id of the svg filter (‘#name’) to apply to the rectangle (default value is None, which means no filter). Filter definitaion should be added to slide.svgdefout list.
  • svgclip (string or None, optional) – Set the id of the clip object (‘#name’) to apply on the rectangle (the default value is None, which means no clip to apply). Clip definition should be added to slide.svgdefout list.

Gallery generated by Sphinx-Gallery