File: C:/Users/fred/anaconda3/Lib/site-packages/holoviews/examples/reference/elements/plotly/Curve.ipynb
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
"<dl class=\"dl-horizontal\">\n",
" <dt>Title</dt> <dd> Curve Element</dd>\n",
" <dt>Dependencies</dt> <dd>Plotly</dd>\n",
" <dt>Backends</dt> <dd><a href='../bokeh/Curve.ipynb'>Bokeh</a></dd> <dd><a href='../matplotlib/Curve.ipynb'>Matplotlib</a></dd> <dd><a href='./Curve.ipynb'>Plotly</a></dd>\n",
"</dl>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"hv.extension('plotly')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"``Curve`` Elements are used to display quantitative values over a continuous interval or time span. They accept tabular data with one key dimension representing the samples along the x-axis and one value dimension of the height of the curve at for each sample. See the [Tabular Datasets](../../../user_guide/08-Tabular_Datasets.ipynb) user guide for supported data formats, which include arrays, pandas dataframes and dictionaries of arrays."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Simple Curve\n",
"\n",
"A ``Curve`` is a set of values provided for some set of keys from a [continuously indexable 1D coordinate system](../../../user_guide/Continuous_Coordinates.ipynb), where the plotted values will be connected up because they are assumed to be samples from a continuous relation."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"points = [(0.1*i, np.sin(0.1*i)) for i in range(100)]\n",
"hv.Curve(points)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Interpolation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``Curve`` also supports the ``interpolation`` plot option to determine whether to linearly interpolate the curve values or to draw discrete steps:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hv.NdOverlay({interp: hv.Curve(points[::8]).opts(interpolation=interp)\n",
" for interp in ['linear', 'steps-mid', 'steps-pre', 'steps-post']})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Curve).``"
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}