arrow

Add arrow to slide. Arrow are drawn using tikz.

from beampy import *

# Remove quiet=True to get beampy compilation outputs
doc = document(quiet=True)

with slide('Draw an arrow'):
    arrow(x=10, y=0.1, dx=780, dy=0, lw=6, color='Crimson')

    rectangle(x=0.05, y=0.3, width=150, height=150,
              color='crimson', edgecolor='None')

    t1 = text('First', y=0.25, x=0.55)
    a1 = arrow(x=t1.right+0, y=t1.bottom+0, dx=100, dy=100)
    t2 = text('Second', y=a1.bottom+0, x=a1.right+0)
    a2 = arrow(x=t2.center+0, y=t2.bottom+0, dx=-100, dy=150, color='red',
               style='<->', bend='left', head_style='latex', lw=4)
    t3 = text('Third', y=a2.bottom+bottom(0), x=a2.left+right(0))

    a3 = arrow(x=t3.left+0, y=t3.center+0, dx=-350, dy=-170,
               color='LightGreen', lw=5, out_angle=180, in_angle=0,
               dashed=True)


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

Module arguments

beampy.arrow(x, y, dx, dy, style=’->’, color=’black’, lw=‘2pt’, in_angle=None, out_angle=None, bend=None, head_style=’‘, dashed=False)

Draw an arrow on slide. Ticks is used to render the arrow.

Parameters:
  • x (int or float or {'center', 'auto'} or str) – Horizontal position for the arrow. See positioning system of Beampy.
  • y (int or float or {'center', 'auto'} or str) – Vertical position for the arrow. See positioning system of Beampy.
  • dx (int or str) – Arrow horizontal displacement relative to x. dx could given in pixel as an integer or a float or in as string with an unit like ‘2cm’. It could be negative (left of x) or positive (right of x).
  • dy (int or str) – Arrow vertical displacement relative to y. dy could given in pixel as an integer or a float or in as string with an unit like ‘2cm’. It could be negative (top of y) or positive (bottom of y).
  • style (str in {'-', '->', '<-', '<->'}, optional) –

    Arrow style (the default value is ‘->’). The style is the one defined by Ticks style:

    • ’->’ or ‘<-‘, simple arrow.
    • ’<->’, two way arrows.
    • ’-‘, a line.
  • color (string, optional) – Arrow Color (the default value is ‘black’). The color is given as Latex svgnames.
  • lw (str or int, optional) – Arrow line width (the default is ‘2pt’). If the value is given as string followed by an unit, it is converted by beampy convert_unit function. It could also be given as an integer.
  • in_angle (int or None, optional) – Angle at the end of the arrow (the default value is None which implies that the angle is automatically computed).
  • out_angle (int or None, optional) – Starting angle of the arrow (the default value is None which implies that the angle is automatically computed).
  • bend ({'left' or 'right'} or None, optional) – Direction of arrow bending (the default value is None, which implies a straight arrow). ‘left’ bends the arrow to the left and ‘right’ to the right.
  • head_style ({'latex' or 'stealth' or ''}, optional) – Tikz head style of the arrow (the default value is ‘’, which implies default head style of Ticks).
  • dashed (True or False, optional) – Create a dashed arrow line (the default value is False).

Gallery generated by Sphinx-Gallery