{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Layered Charts" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A `LayeredChart` allows you to stack multiple individual charts on top of each other as layers. For example, this could be used to create a chart with both lines and points." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import altair as alt\n", "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Data" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "np.random.seed(181)\n", "data = pd.DataFrame({'x': np.arange(10),\n", " 'y':np.random.rand(10)})" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | x | \n", "y | \n", "
---|---|---|
0 | \n", "0 | \n", "0.524023 | \n", "
1 | \n", "1 | \n", "0.114090 | \n", "
2 | \n", "2 | \n", "0.570567 | \n", "
3 | \n", "3 | \n", "0.405836 | \n", "
4 | \n", "4 | \n", "0.182134 | \n", "