From c259a92b3390d8c7e85ea4f23218d679a6408434 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Tue, 12 Nov 2024 13:53:42 -0500 Subject: [PATCH 1/5] Rename doc -> docs and move images and GIFs into assets folder. --- README.rst | 8 +- .../PlotlyViewerExample-checkpoint.ipynb | 404 ++++++++++++++++++ .../assets/img}/BqplotToolbarHighlighted.png | Bin .../assets/img}/PlotlyViewerExample.ipynb | 168 +++++++- .../assets/img}/QtChartStudioExport.gif | Bin {doc => docs/assets/img}/QtToolbarExport.gif | Bin 6 files changed, 556 insertions(+), 24 deletions(-) create mode 100644 docs/.ipynb_checkpoints/PlotlyViewerExample-checkpoint.ipynb rename {doc => docs/assets/img}/BqplotToolbarHighlighted.png (100%) rename {doc => docs/assets/img}/PlotlyViewerExample.ipynb (59%) rename {doc => docs/assets/img}/QtChartStudioExport.gif (100%) rename {doc => docs/assets/img}/QtToolbarExport.gif (100%) diff --git a/README.rst b/README.rst index f605c8f..acca1d0 100644 --- a/README.rst +++ b/README.rst @@ -61,7 +61,7 @@ Viewers This package contains two experimental Plotly-powered viewers which can be used with glue-jupyter - a scatter viewer and a histogram viewer. More viewers to come in the future! -`This notebook `_ demonstrates +`This notebook `_ demonstrates basic usage of the these viewers, such as importing and viewer creation. @@ -81,9 +81,9 @@ Package Structure .. |Coverage Status| image:: https://codecov.io/gh/glue-viz/glue-plotly/branch/master/graph/badge.svg :target: https://codecov.io/gh/glue-viz/glue-plotly :alt: Glue-plotly's Coverage Status -.. |Qt toolbar demo| image:: https://raw.githubusercontent.com/glue-viz/glue-plotly/main/doc/QtToolbarExport.gif +.. |Qt toolbar demo| image:: https://raw.githubusercontent.com/glue-viz/glue-plotly/main/docs/assets/img/QtToolbarExport.gif :alt: Qt Plotly export demo -.. |bqplot toolbar| image:: https://raw.githubusercontent.com/glue-viz/glue-plotly/main/doc/BqplotToolbarHighlighted.png +.. |bqplot toolbar| image:: https://raw.githubusercontent.com/glue-viz/glue-plotly/main/docs/assets/img/BqplotToolbarHighlighted.png :alt: bqplot Plotly export tool -.. |Chart Studio demo| image:: https://raw.githubusercontent.com/glue-viz/glue-plotly/main/doc/QtChartStudioExport.gif +.. |Chart Studio demo| image:: https://raw.githubusercontent.com/glue-viz/glue-plotly/main/docs/assets/img/QtChartStudioExport.gif :alt: Qt Chart Studio export demo diff --git a/docs/.ipynb_checkpoints/PlotlyViewerExample-checkpoint.ipynb b/docs/.ipynb_checkpoints/PlotlyViewerExample-checkpoint.ipynb new file mode 100644 index 0000000..c6620a1 --- /dev/null +++ b/docs/.ipynb_checkpoints/PlotlyViewerExample-checkpoint.ipynb @@ -0,0 +1,404 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "d5103242-a264-4f98-a168-ab40087f8c0c", + "metadata": {}, + "source": [ + "# Plotly Viewer Examples\n", + "This notebook contains examples of how to use the viewers provided by the `glue-plotly` package" + ] + }, + { + "cell_type": "markdown", + "id": "9101e7af-1a3a-4152-b43f-829c52a3d166", + "metadata": {}, + "source": [ + "### Imports" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "75a31f1b-a32a-42ba-a016-f324faa9f3a7", + "metadata": {}, + "outputs": [], + "source": [ + "from glue.core import Data\n", + "from glue_jupyter import jglue\n", + "from glue_plotly.viewers.histogram.viewer import PlotlyHistogramView\n", + "from glue_plotly.viewers.scatter.viewer import PlotlyScatterView" + ] + }, + { + "cell_type": "markdown", + "id": "c015dc70-746f-415b-853f-c31ea92cff67", + "metadata": {}, + "source": [ + "Create a glue-jupyter application and session" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "0746adc6-dbe1-4f85-8690-da24458667c0", + "metadata": {}, + "outputs": [], + "source": [ + "app = jglue()\n", + "session = app.session\n", + "dc = app.session.data_collection" + ] + }, + { + "cell_type": "markdown", + "id": "7d6adbc6-93b8-4a0e-8505-83ef23fb2f6b", + "metadata": {}, + "source": [ + "Create some random data to use, and do a bit of styling" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "95d749da-73c8-432a-9a23-85d37e1b6fb5", + "metadata": {}, + "outputs": [], + "source": [ + "from random import randint\n", + "x = [randint(0, 100) for _ in range(100)]\n", + "y = [randint(300, 400) for _ in range(100)]\n", + "data = Data(label='data', x=x, y=y)\n", + "dc.append(data)\n", + "data.style.color = \"#0000ff\"\n", + "data.style.markersize = 6" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "92745ee0-25bf-455a-b022-045059fa8e19", + "metadata": {}, + "outputs": [], + "source": [ + "x2 = [randint(0, 100) for _ in range(100)]\n", + "y2 = [randint(300, 400) for _ in range(100)]\n", + "data2 = Data(label='data2', x=x2, y=y2)\n", + "dc.append(data2)\n", + "app.add_link(data, 'x', data2, 'x')\n", + "app.add_link(data, 'y', data2, 'y')\n", + "data.style.color = \"#0000ff\"\n", + "data.style.markersize = 6" + ] + }, + { + "cell_type": "markdown", + "id": "2c520488-472c-4c43-8f29-3ae91fe41c13", + "metadata": {}, + "source": [ + "### Create a Plotly Scatter Viewer" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "cf42768e-6d31-4375-90ee-facd8d19800a", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "29dfa73fb7554c97a66b58cd2cafee9d", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "LayoutWidget(controls={'toolbar_selection_tools': BasicJupyterToolbar(template=Template(template='