{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#### **Title**: HLine Element\n", "\n", "**Dependencies**: Matplotlib\n", "\n", "**Backends**: [Bokeh](../bokeh/HLine.ipynb), [Matplotlib](./HLine.ipynb), [Plotly](../plotly/HLine.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import holoviews as hv\n", "from holoviews import opts\n", "\n", "hv.extension('matplotlib')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The ``HLine`` element is a type of annotation that marks a position along the y-axis. Here is an ``HLine`` element that marks the mean of a points distributions:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "xs = np.random.normal(size=100)\n", "ys = np.random.normal(size=100) * xs\n", "points = hv.Points((xs,ys))\n", "\n", "(points * hv.HLine(ys.mean())).opts(\n", " opts.HLine(color='blue', linewidth=6),\n", " opts.Points(color='#D3D3D3'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For full documentation and the available style and plot options, use ``hv.help(hv.HLine).``" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }