{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "cb6eb7b5", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "from bqplot import *\n", "\n", "np.random.seed(0)\n", "data = np.random.randn(10, 10)\n", "\n", "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True), ColorScale()\n", "ax_x = Axis(scale=x_sc)\n", "ax_y = Axis(scale=y_sc, orientation='vertical')\n", "\n", "## The data along the rows is not uniform. Hence the 5th row(from top) of the map\n", "## is twice the height of the remaining rows.\n", "row_data = np.arange(10)\n", "row_data[5:] = np.arange(6, 11)\n", "\n", "column_data = np.arange(10, 20)\n", "\n", "grid_map = GridHeatMap(row=row_data, column=column_data, color=data,\n", " scales={'row': y_sc, 'column': x_sc, 'color': col_sc})\n", "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])" ] }, { "cell_type": "code", "execution_count": null, "id": "37e8d7e8", "metadata": {}, "outputs": [], "source": [ "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True), ColorScale()\n", "ax_x = Axis(scale=x_sc)\n", "ax_y = Axis(scale=y_sc, orientation='vertical')\n", "\n", "row_data = np.arange(11)\n", "column_data = np.arange(10, 21)\n", "\n", "grid_map = GridHeatMap(row=row_data, column=column_data, color=data,\n", " scales={'row': y_sc, 'column': x_sc, 'color': col_sc})\n", "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])" ] }, { "cell_type": "code", "execution_count": null, "id": "ab29f72f", "metadata": {}, "outputs": [], "source": [ "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True, max=15), ColorScale()\n", "ax_x = Axis(scale=x_sc)\n", "ax_y = Axis(scale=y_sc, orientation='vertical')\n", "\n", "row_data = np.arange(10)\n", "column_data = np.arange(10, 20)\n", "\n", "grid_map = GridHeatMap(row=row_data, column=column_data, color=data,\n", " scales={'row': y_sc, 'column': x_sc, 'color': col_sc})\n", "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])" ] }, { "cell_type": "code", "execution_count": null, "id": "0a88dff7", "metadata": {}, "outputs": [], "source": [ "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True, min=-5, max=15), ColorScale()\n", "ax_x = Axis(scale=x_sc)\n", "ax_y = Axis(scale=y_sc, orientation='vertical')\n", "\n", "row_data = np.arange(10)\n", "column_data = np.arange(10, 20)\n", "\n", "grid_map = GridHeatMap(row=row_data, column=column_data, color=data,\n", " scales={'row': y_sc, 'column': x_sc, 'color': col_sc},\n", " row_align='end')\n", "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])" ] }, { "cell_type": "code", "execution_count": null, "id": "dcb2120f", "metadata": {}, "outputs": [], "source": [ "x_sc, y_sc, col_sc = LinearScale(), LinearScale(reverse=True, min=-5, max=15), ColorScale()\n", "ax_x = Axis(scale=x_sc)\n", "ax_y = Axis(scale=y_sc, orientation='vertical')\n", "\n", "row_data = np.arange(9)\n", "column_data = np.arange(10, 20)\n", "\n", "grid_map = GridHeatMap(row=row_data, column=column_data, color=data, \n", " scales={'row': y_sc, 'column': x_sc, 'color': col_sc}, row_align='end')\n", "Figure(marks=[grid_map], padding_y=0.0, axes=[ax_x, ax_y])" ] } ], "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 }