{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import ipywidgets as widgets\n", "import numpy as np\n", "from bqplot import pyplot as plt\n", "import bqplot\n", "from bqplot import Tooltip\n", "\n", "np.random.seed(0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Dashboard Experiment\n", "Cleaning imports" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This demo uses voila to render a notebook to a custom HTML page using gridstack.js for the layout of each output. In the cell metadata you can change the default cell with and height (in grid units between 1 and 12) by specifying.\n", " * `grid_row`\n", " * `grid_columns`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Generate Toy Data" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "n = 1000\n", "x = np.linspace(0.0, 10.0, n)\n", "y = np.cumsum(np.random.randn(n)*10).astype(int)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "fig_1 = plt.figure(title='Scatter')\n", "def_tt = Tooltip(fields=['x'], formats=[''])\n", "scatter_1 = plt.scatter(x,y, tooltip=def_tt)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "scatter_1.colors=['black']" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "scatter_1.default_opacities=[1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.2, 0.1, 0.1]" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "5241bf14431740a2b15a11f699742605", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Figure(axes=[Axis(scale=LinearScale(), side='bottom'), Axis(orientation='vertical', scale=LinearScale(), side=…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig_1" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.5" } }, "nbformat": 4, "nbformat_minor": 2 }