{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import nbinteract as nbi\n", "import numpy as np\n", "from numpy import arange" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "08511fbe4b2545a888c10b2a4cbf409e", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(Label(value='y = 1.01x + 0.49'), Figure(animation_duration=1000, axes=[Axis(grid_color='gray', …" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "x_points = np.arange(10)\n", "y_points = np.arange(10) + np.random.rand(10)\n", "\n", "\n", "options = {\n", " 'title': 'Interactive Scatter Plot',\n", " 'animation_duration': 1000,\n", " 'xlabel': 'x-values',\n", " 'ylabel': 'y-values',\n", " 'xlim': (0, 10),\n", " 'ylim': (0, 10)\n", "}\n", "\n", "layouts = {\n", " 'plot_height': '480px',\n", " 'plot_width': '800px',\n", "}\n", "\n", "show_eqn = False\n", "\n", "scatter_drag = nbi.scatter_drag(\n", " x_points,\n", " y_points,\n", " options=options,\n", " layouts=layouts\n", ")\n", "\n", "scatter_drag" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.7.9" } }, "nbformat": 4, "nbformat_minor": 4 }