{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "
\n", "
Title
Spline Element
\n", "
Dependencies
Matplotlib
\n", "
Backends
Matplotlib
Bokeh
\n", "
\n", "
" ] }, { "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 ``Spline`` annotation is used to draw cubic Bezier curves. In the overlay below, the spline is in green and the control points are shown by the light grey line:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%opts Curve (color='#D3D3D3') Spline (linewidth=6 edgecolor='green')\n", "points = [(-0.3, -0.3), (0,0), (0.25, -0.25), (0.3, 0.3)]\n", "hv.Spline((points, [1,4,4,4])) * hv.Curve(points)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first argument to ``Splines`` are the control point positions and the integers in the second list are the control codes, as documented in the [matplotlib splines documentation](http://matplotlib.org/api/path_api.html).\n", "\n", "For full documentation and the available style and plot options, use ``hv.help(hv.Spline).``" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }