"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"hv.extension('matplotlib')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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 '^':"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"xs = np.linspace(-5,5,100)\n",
"ys = -(xs-2)**3\n",
"\n",
"curve = hv.Curve((xs,ys))\n",
"arrow = hv.Arrow(0, 5, 'Inflection', 'v')\n",
"\n",
"curve.opts(color='#D3D3D3') * arrow"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Additionally we can pick between a number of different arrow styles including '-[', '->' and '<->':"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"np.random.seed(12)\n",
"points = hv.Points(np.random.randn(100, 2))\n",
"(points * hv.Arrow(2, points['y'].min(), 'Min', 'v', arrowstyle='-[') *\n",
"hv.Arrow(2, points['y'].max(), 'Max', '^', arrowstyle='-[')).redim.range(y=(-5, 5), x=(-3, 3))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Arrow).``"
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 1
}