Debian Codegraph @

bqplot/ui-tests/tests/notebooks/hist_update.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": null,
6 "id": "athletic-functionality",
7 "metadata": {},
8 "outputs": [],
9 "source": [
10 "from bqplot import *\n",
11 "\n",
12 "import numpy as np\n",
13 "import pandas as pd\n",
14 "\n",
15 "size = 2000\n",
16 "np.random.seed(0)\n",
17 "\n",
18 "x_data = range(size)\n",
19 "y_data = np.random.randn(size)\n",
20 "y_data_2 = np.random.randn(size)\n",
21 "y_data_3 = np.cumsum(np.random.randn(size) * 100.)\n",
22 "\n",
23 "# Create Bar\n",
24 "x_ord = LinearScale()\n",
25 "y_sc = LinearScale()\n",
26 "\n",
27 "hist = Hist(sample=y_data, scales={'sample': x_ord, 'count': y_sc})\n",
28 "ax_x = Axis(scale=x_ord)\n",
29 "ax_y = Axis(scale=y_sc, tick_format='0.2f', orientation='vertical')\n",
30 "\n",
31 "fig = Figure(marks=[hist], axes=[ax_x, ax_y], padding_x=0.025, padding_y=0.025)\n",
32 "fig"
33 ]
34 },
35 {
36 "cell_type": "code",
37 "execution_count": null,
38 "id": "conventional-voice",
39 "metadata": {},
40 "outputs": [],
41 "source": [
42 "hist.sample = y_data_2"
43 ]
44 },
45 {
46 "cell_type": "code",
47 "execution_count": null,
48 "id": "convinced-boulder",
49 "metadata": {},
50 "outputs": [],
51 "source": [
52 "hist.sample = y_data_3"
53 ]
54 },
55 {
56 "cell_type": "code",
57 "execution_count": null,
58 "id": "adjustable-advertising",
59 "metadata": {},
60 "outputs": [],
61 "source": [
62 "hist.bins = 100"
63 ]
64 },
65 {
66 "cell_type": "code",
67 "execution_count": null,
68 "id": "collective-means",
69 "metadata": {},
70 "outputs": [],
71 "source": [
72 "hist.colors = ['red', 'blue', 'green']"
73 ]
74 },
75 {
76 "cell_type": "code",
77 "execution_count": null,
78 "id": "liked-rapid",
79 "metadata": {},
80 "outputs": [],
81 "source": [
82 "hist.opacities = [0.5, 0.2, 0.3]"
83 ]
84 },
85 {
86 "cell_type": "code",
87 "execution_count": null,
88 "id": "seventh-compact",
89 "metadata": {},
90 "outputs": [],
91 "source": [
92 "hist.selected_style = {'fill': 'purple'}\n",
93 "hist.selected = [0, 100]"
94 ]
95 },
96 {
97 "cell_type": "code",
98 "execution_count": null,
99 "id": "incomplete-power",
100 "metadata": {},
101 "outputs": [],
102 "source": [
103 "hist.selected = None"
104 ]
105 }
106 ],
107 "metadata": {
108 "kernelspec": {
109 "display_name": "Python 3",
110 "language": "python",
111 "name": "python3"
112 },
113 "language_info": {
114 "codemirror_mode": {
115 "name": "ipython",
116 "version": 3
117 },
118 "file_extension": ".py",
119 "mimetype": "text/x-python",
120 "name": "python",
121 "nbconvert_exporter": "python",
122 "pygments_lexer": "ipython3",
123 "version": "3.9.2"
124 }
125 },
126 "nbformat": 4,
127 "nbformat_minor": 5
128 }