{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Using plugins in PerspectiveWidget\n", "\n", "`PerspectiveWidget` comes with a set of plugins that are able to visualize your data." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from perspective import PerspectiveWidget" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data = {\n", " \"int\": [i for i in range(4)],\n", " \"float\": [i * 1.25 for i in range(4)],\n", " \"str\": [\"a\", \"b\", \"c\", \"d\"],\n", " \"bool\": [True, False, True, False],\n", " \"date\": [date.today() for i in range(4)],\n", " \"datetime\": [datetime.now() for i in range(4)]\n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Pass the plugin name into the kwargs of `PerspectiveWidget` or `start`. Once the viewer has been initialized, you can select plugins at the top left corner (and see the parsable names for each one)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "widget = PerspectiveWidget(data, plugin=\"d3_x_bar\")\n", "widget" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "widget2 = PerspectiveWidget(data, plugin=\"d3_heatmap\")\n", "widget2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plugins can be set from the notebook:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "widget.plugin = \"datagrid\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "widget.plugin = \"d3_y_line\"" ] } ], "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.7.5" } }, "nbformat": 4, "nbformat_minor": 4 }