{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "
\n", "
Title
Curve Element
\n", "
Dependencies
Bokeh
\n", "
Backends
\n", "
Bokeh
\n", "
Matplotlib
\n", "
Plotly
\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import holoviews as hv\n", "hv.extension('bokeh')" ] }, { "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": [ "overlay =hv.NdOverlay({interp: hv.Curve(points[::8]).opts(interpolation=interp, width=600)\n", " for interp in ['linear', 'steps-mid', 'steps-pre', 'steps-post']})\n", "overlay.opts(legend_position='right')" ] }, { "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 }