From e0482224835e11ab6d508bd7ef675df415f8b504 Mon Sep 17 00:00:00 2001 From: Jon Mease <jon.mease@gmail.com> Date: Tue, 24 Jul 2018 13:05:52 -0400 Subject: [PATCH] Use go.FigureWidget --- notebooks/DataShaderExample.ipynb | 23 +++++++++++++++-------- notebooks/nyc_taxi_selection.ipynb | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/notebooks/DataShaderExample.ipynb b/notebooks/DataShaderExample.ipynb index f2230dc..6aa51cd 100644 --- a/notebooks/DataShaderExample.ipynb +++ b/notebooks/DataShaderExample.ipynb @@ -21,8 +21,6 @@ "metadata": {}, "outputs": [], "source": [ - "from plotly.graph_objs import FigureWidget\n", - "\n", "# core\n", "import io\n", "import base64 \n", @@ -151,6 +149,15 @@ "# Create FigureWidget with background image" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import plotly.graph_objs as go" + ] + }, { "cell_type": "code", "execution_count": null, @@ -159,11 +166,11 @@ }, "outputs": [], "source": [ - "f = FigureWidget(data=[{'x': x_range, \n", - " 'y': y_range, \n", - " 'mode': 'markers',\n", - " 'marker': {'opacity': 0}}], # invisible trace to init axes and to support autoresize\n", - " layout={'width': plot_width, 'height': plot_height})\n", + "f = go.FigureWidget(data=[{'x': x_range, \n", + " 'y': y_range, \n", + " 'mode': 'markers',\n", + " 'marker': {'opacity': 0}}], # invisible trace to init axes and to support autoresize\n", + " layout={'width': plot_width, 'height': plot_height})\n", "f" ] }, @@ -174,7 +181,7 @@ "outputs": [], "source": [ "# Set background image\n", - "f.layout.images = [dict(\n", + "f.layout.images = [go.layout.Image(\n", " source = initial_img, # plotly now performs auto conversion of PIL image to png data URI\n", " xref = \"x\",\n", " yref = \"y\",\n", diff --git a/notebooks/nyc_taxi_selection.ipynb b/notebooks/nyc_taxi_selection.ipynb index 6bab48f..5822c64 100644 --- a/notebooks/nyc_taxi_selection.ipynb +++ b/notebooks/nyc_taxi_selection.ipynb @@ -262,7 +262,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.6" } }, "nbformat": 4, -- GitLab