Debian Codegraph @

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

raw
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": null,
6 "id": "cb6eb7b5",
7 "metadata": {},
8 "outputs": [],
9 "source": [
10 "import numpy as np\n",
11 "from bqplot import *\n",
12 "\n",
13 "np.random.seed(0)\n",
14 "data = np.random.randn(10, 10)\n",
15 "\n",
16 "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True), ColorScale()\n",
17 "ax_x = Axis(scale=x_sc)\n",
18 "ax_y = Axis(scale=y_sc, orientation='vertical')\n",
19 "\n",
20 "## The data along the rows is not uniform. Hence the 5th row(from top) of the map\n",
21 "## is twice the height of the remaining rows.\n",
22 "row_data = np.arange(10)\n",
23 "row_data[5:] = np.arange(6, 11)\n",
24 "\n",
25 "column_data = np.arange(10, 20)\n",
26 "\n",
27 "grid_map = GridHeatMap(row=row_data, column=column_data, color=data,\n",
28 " scales={'row': y_sc, 'column': x_sc, 'color': col_sc})\n",
29 "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])"
30 ]
31 },
32 {
33 "cell_type": "code",
34 "execution_count": null,
35 "id": "37e8d7e8",
36 "metadata": {},
37 "outputs": [],
38 "source": [
39 "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True), ColorScale()\n",
40 "ax_x = Axis(scale=x_sc)\n",
41 "ax_y = Axis(scale=y_sc, orientation='vertical')\n",
42 "\n",
43 "row_data = np.arange(11)\n",
44 "column_data = np.arange(10, 21)\n",
45 "\n",
46 "grid_map = GridHeatMap(row=row_data, column=column_data, color=data,\n",
47 " scales={'row': y_sc, 'column': x_sc, 'color': col_sc})\n",
48 "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])"
49 ]
50 },
51 {
52 "cell_type": "code",
53 "execution_count": null,
54 "id": "ab29f72f",
55 "metadata": {},
56 "outputs": [],
57 "source": [
58 "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True, max=15), ColorScale()\n",
59 "ax_x = Axis(scale=x_sc)\n",
60 "ax_y = Axis(scale=y_sc, orientation='vertical')\n",
61 "\n",
62 "row_data = np.arange(10)\n",
63 "column_data = np.arange(10, 20)\n",
64 "\n",
65 "grid_map = GridHeatMap(row=row_data, column=column_data, color=data,\n",
66 " scales={'row': y_sc, 'column': x_sc, 'color': col_sc})\n",
67 "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])"
68 ]
69 },
70 {
71 "cell_type": "code",
72 "execution_count": null,
73 "id": "0a88dff7",
74 "metadata": {},
75 "outputs": [],
76 "source": [
77 "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True, min=-5, max=15), ColorScale()\n",
78 "ax_x = Axis(scale=x_sc)\n",
79 "ax_y = Axis(scale=y_sc, orientation='vertical')\n",
80 "\n",
81 "row_data = np.arange(10)\n",
82 "column_data = np.arange(10, 20)\n",
83 "\n",
84 "grid_map = GridHeatMap(row=row_data, column=column_data, color=data,\n",
85 " scales={'row': y_sc, 'column': x_sc, 'color': col_sc},\n",
86 " row_align='end')\n",
87 "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])"
88 ]
89 },
90 {
91 "cell_type": "code",
92 "execution_count": null,
93 "id": "dcb2120f",
94 "metadata": {},
95 "outputs": [],
96 "source": [
97 "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True, min=-5, max=15), ColorScale()\n",
98 "ax_x = Axis(scale=x_sc)\n",
99 "ax_y = Axis(scale=y_sc, orientation='vertical')\n",
100 "\n",
101 "row_data = np.arange(9)\n",
102 "column_data = np.arange(10, 20)\n",
103 "\n",
104 "grid_map = GridHeatMap(row=row_data, column=column_data, color=data, \n",
105 " scales={'row': y_sc, 'column': x_sc, 'color': col_sc}, row_align='end')\n",
106 "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])"
107 ]
108 }
109 ],
110 "metadata": {
111 "kernelspec": {
112 "display_name": "Python 3",
113 "language": "python",
114 "name": "python3"
115 },
116 "language_info": {
117 "codemirror_mode": {
118 "name": "ipython",
119 "version": 3
120 },
121 "file_extension": ".py",
122 "mimetype": "text/x-python",
123 "name": "python",
124 "nbconvert_exporter": "python",
125 "pygments_lexer": "ipython3",
126 "version": "3.9.2"
127 }
128 },
129 "nbformat": 4,
130 "nbformat_minor": 5
131 }