{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "athletic-functionality", "metadata": {}, "outputs": [], "source": [ "from bqplot import *\n", "\n", "import numpy as np\n", "import pandas as pd\n", "\n", "size = 2000\n", "np.random.seed(0)\n", "\n", "x_data = range(size)\n", "y_data = np.random.randn(size)\n", "y_data_2 = np.random.randn(size)\n", "y_data_3 = np.cumsum(np.random.randn(size) * 100.)\n", "\n", "# Create Bar\n", "x_ord = LinearScale()\n", "y_sc = LinearScale()\n", "\n", "hist = Hist(sample=y_data, scales={'sample': x_ord, 'count': y_sc})\n", "ax_x = Axis(scale=x_ord)\n", "ax_y = Axis(scale=y_sc, tick_format='0.2f', orientation='vertical')\n", "\n", "fig = Figure(marks=[hist], axes=[ax_x, ax_y], padding_x=0.025, padding_y=0.025)\n", "fig" ] }, { "cell_type": "code", "execution_count": null, "id": "conventional-voice", "metadata": {}, "outputs": [], "source": [ "hist.sample = y_data_2" ] }, { "cell_type": "code", "execution_count": null, "id": "convinced-boulder", "metadata": {}, "outputs": [], "source": [ "hist.sample = y_data_3" ] }, { "cell_type": "code", "execution_count": null, "id": "adjustable-advertising", "metadata": {}, "outputs": [], "source": [ "hist.bins = 100" ] }, { "cell_type": "code", "execution_count": null, "id": "collective-means", "metadata": {}, "outputs": [], "source": [ "hist.colors = ['red', 'blue', 'green']" ] }, { "cell_type": "code", "execution_count": null, "id": "liked-rapid", "metadata": {}, "outputs": [], "source": [ "hist.opacities = [0.5, 0.2, 0.3]" ] }, { "cell_type": "code", "execution_count": null, "id": "seventh-compact", "metadata": {}, "outputs": [], "source": [ "hist.selected_style = {'fill': 'purple'}\n", "hist.selected = [0, 100]" ] }, { "cell_type": "code", "execution_count": null, "id": "incomplete-power", "metadata": {}, "outputs": [], "source": [ "hist.selected = None" ] } ], "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.9.2" } }, "nbformat": 4, "nbformat_minor": 5 }