Arrow

Download this notebook from GitHub (right-click to download).


Title
Arrow
Dependencies
Matplotlib
Backends
Bokeh
Matplotlib
In [1]:
import numpy as np
import holoviews as hv
hv.extension('matplotlib')

The Arrow element is a type of annotation that points to a position on a visualization with optional text. It allows specifying an x- and y-position along with a label and a direction which may be one of '<', '>', 'v' and '^':

In [2]:
xs = np.linspace(-5,5,100)
ys = -(xs-2)**3

curve = hv.Curve((xs,ys))
arrow = hv.Arrow(0, 5, 'Inflection', 'v')

curve.opts(color='#D3D3D3') * arrow
WARNING:param.ArrowPlot01657: Arrow textsize style option is deprecated, use textsize option instead.
Out[2]:

Additionally we can pick between a number of different arrow styles including '-[', '->' and '<->':

In [3]:
np.random.seed(12)
points = hv.Points(np.random.randn(100, 2))
(points * hv.Arrow(2, points['y'].min(), 'Min', 'v', arrowstyle='-[') *
hv.Arrow(2, points['y'].max(), 'Max', '^', arrowstyle='-[')).redim.range(y=(-5, 5), x=(-3, 3))
WARNING:param.ArrowPlot01893: Arrow textsize style option is deprecated, use textsize option instead.
WARNING:param.ArrowPlot01904: Arrow textsize style option is deprecated, use textsize option instead.
Out[3]:

For full documentation and the available style and plot options, use hv.help(hv.Arrow).


Download this notebook from GitHub (right-click to download).