From 90796662667d2d299ece1c0791463ca776fc280a Mon Sep 17 00:00:00 2001 From: jlstevens Date: Sun, 4 Jun 2017 21:45:11 +0100 Subject: [PATCH] Made Box element notebooks Python 3 compatible --- examples/elements/bokeh/Box.ipynb | 7 ++++--- examples/elements/matplotlib/Box.ipynb | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/elements/bokeh/Box.ipynb b/examples/elements/bokeh/Box.ipynb index 2de91ee7f3..83dcd03b7b 100644 --- a/examples/elements/bokeh/Box.ipynb +++ b/examples/elements/bokeh/Box.ipynb @@ -43,8 +43,9 @@ "source": [ "%%opts Box (line_width=5 color='red') Image (cmap='gray')\n", "data = np.sin(np.mgrid[0:100,0:100][1]/10.0)\n", - "data[range(40, 60) + range(40,50), range(20, 40)+ range(70,80)] = -3\n", - "hv.Image(data) * hv.Box(-0.2, 0, 0.2 ) * hv.Box(-0, 0, (0.4,0.9) )" + "data[np.arange(40, 60), np.arange(20, 40)] = -1\n", + "data[np.arange(40, 50), np.arange(70, 80)] = -3 \n", + "hv.Image(data) * hv.Box(-0.2, 0, 0.25 ) * hv.Box(-0, 0, (0.4,0.9) )" ] }, { @@ -66,7 +67,7 @@ "source": [ "%%opts Box (line_width=5 color='purple') Image (cmap='gray')\n", "data = np.sin(np.mgrid[0:100,0:100][1]/10.0)\n", - "data[range(30, 70), range(30, 70)] = -3\n", + "data[np.arange(30, 70), np.arange(30, 70)] = -3\n", "hv.Image(data) * hv.Box(-0, 0, 0.25, aspect=3, orientation=-np.pi/4)" ] } diff --git a/examples/elements/matplotlib/Box.ipynb b/examples/elements/matplotlib/Box.ipynb index 8b8c9f13f8..61b3281a31 100644 --- a/examples/elements/matplotlib/Box.ipynb +++ b/examples/elements/matplotlib/Box.ipynb @@ -43,8 +43,9 @@ "source": [ "%%opts Box (linewidth=5 color='red') Image (cmap='gray')\n", "data = np.sin(np.mgrid[0:100,0:100][1]/10.0)\n", - "data[range(40, 60) + range(40,50), range(20, 40)+ range(70,80)] = -3\n", - "hv.Image(data) * hv.Box(-0.2, 0, 0.2 ) * hv.Box(-0, 0, (0.4,0.9) )" + "data[np.arange(40, 60), np.arange(20, 40)] = -1\n", + "data[np.arange(40, 50), np.arange(70, 80)] = -3 \n", + "hv.Image(data) * hv.Box(-0.2, 0, 0.25 ) * hv.Box(-0, 0, (0.4,0.9) )" ] }, { @@ -66,7 +67,7 @@ "source": [ "%%opts Box (linewidth=5 color='purple') Image (cmap='gray')\n", "data = np.sin(np.mgrid[0:100,0:100][1]/10.0)\n", - "data[range(30, 70), range(30, 70)] = -3\n", + "data[np.arange(30, 70), np.arange(30, 70)] = -3\n", "hv.Image(data) * hv.Box(-0, 0, 0.25, aspect=3, orientation=-np.pi/4)" ] }