Skip to content

Commit

Permalink
Merge pull request #50 from Carifio24/more-readme
Browse files Browse the repository at this point in the history
More README updates
  • Loading branch information
Carifio24 authored Oct 20, 2023
2 parents 7221005 + 8b4e39f commit 0b99b89
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 9 deletions.
33 changes: 24 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ to `Plotly <https://plotly.com/>`_. This includes three main pieces of functiona
Installation
============

glue-plotly can be installed using pip:::
glue-plotly can be installed using pip::

pip install glue-plotly

Expand All @@ -32,11 +32,15 @@ and `glue-jupyter <https://github.com/glue-viz/glue-jupyter>`_

For glue-qt, all of the built-in matplotlib viewers are supported, along with the dendrogram viewer
and the 3D scatter viewer from the `glue-vispy-viewers <https://github.com/glue-viz/glue-vispy-viewers>`_ plugin.
For glue-jupyter, the bqplot scatter, image, profile, and histogram viewers are supported.
For glue-jupyter, the bqplot scatter, image, profile, and histogram viewers are supported. In glue-qt,
these tools are subtools of the "save" meta-tool and can be accessed from its dropdown menu.

|Qt toolbar demo|

In glue-qt, these tools are subtools of the "save" meta-tool and can be accessed from its dropdown menu.
In glue-jupyter, the Plotly exporter tools are top-level toolbar tools (look for the Plotly logo!)

|bqplot toolbar|

============
Chart Studio
============
Expand All @@ -47,23 +51,28 @@ and profile viewers.

To access the exporter inside Qt glue, navigate to File > Advanced Exporters > Plotly.

|Chart Studio demo|


========
Viewers
========

This package contains two experimental Plotly-powered viewers - a scatter viewer and a histogram viewer.
More viewers to come in the future!
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 <https://github.com/glue-viz/glue-plotly/blob/main/doc/PlotlyViewerExample.ipynb>`_ demonstrates
basic usage of the these viewers, such as importing and viewer creation.


=================
Package Structure
=================

- `common` contains methods for creating Plotly `graph objects <https://plotly.com/python/graph-objects/>`_ traces to represent glue layers and viewers that are shared between the exporters and Plotly viewers.
- `html_exporters` contains the implementations of the HTML exporter tools for glue-qt and glue-jupyter
- `web` contains the implementation of the Chart Studio exporter for Qt glue
- `viewers` contains the implementations of the Plotly viewers
- ``common`` contains methods for creating Plotly `graph objects <https://plotly.com/python/graph-objects/>`_ traces to represent glue layers and viewers that are shared between the exporters and Plotly viewers.
- ``html_exporters`` contains the implementations of the HTML exporter tools for glue-qt and glue-jupyter
- ``web`` contains the implementation of the Chart Studio exporter for Qt glue
- ``viewers`` contains the implementations of the Plotly viewers


.. |Actions Status| image:: https://github.com/glue-viz/glue-plotly/workflows/ci_workflows.yml/badge.svg
Expand All @@ -72,3 +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
:alt: Qt Plotly export demo
.. |bqplot toolbar| image:: https://raw.githubusercontent.com/glue-viz/glue-plotly/main/doc/BqplotToolbarHighlighted.png
:alt: bqplot Plotly export tool
.. |Chart Studio demo| image:: https://raw.githubusercontent.com/glue-viz/glue-plotly/main/doc/QtChartStudioExport.gif
:alt: Qt Chart Studio export demo
96 changes: 96 additions & 0 deletions doc/PlotlyViewerExample.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"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": "code",
"execution_count": null,
"id": "0746adc6-dbe1-4f85-8690-da24458667c0",
"metadata": {},
"outputs": [],
"source": [
"app = jglue()\n",
"session = app.session\n",
"dc = app.session.data_collection"
]
},
{
"cell_type": "code",
"execution_count": null,
"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)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cf42768e-6d31-4375-90ee-facd8d19800a",
"metadata": {},
"outputs": [],
"source": [
"viewer = app.new_data_viewer(PlotlyScatterView, data=data)\n",
"layer = viewer.layers[0]\n",
"layer.state.color = \"#ff0000\"\n",
"layer.state.size = 4"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3e66be74-929f-4cfa-910c-9d3b65b4ac91",
"metadata": {},
"outputs": [],
"source": [
"viewer = app.new_data_viewer(PlotlyHistogramView, data=data)\n",
"layer = viewer.layers[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4f9d9ffe-ec2e-4d7f-aa8b-8b2a7524b9c2",
"metadata": {},
"outputs": [],
"source": []
}
],
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Binary file added doc/QtChartStudioExport.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0b99b89

Please sign in to comment.