Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement backend options transformer #653

Merged
merged 62 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
56b8183
Implement backend options transformer
philippjfr Aug 24, 2021
319b5fd
Improvements for transfer_opts
philippjfr Sep 1, 2021
e143a9c
Fix undefined variable
philippjfr Sep 1, 2021
252198c
Don't override transformed opts with mpl size opts
maximlt Sep 6, 2021
1d9090e
Add VS code and Mac files to ignore
maximlt Sep 6, 2021
483fe17
Extend the matplotlib transforms mapping
maximlt Sep 7, 2021
1a54be5
Merge branch 'master' into backend_transformer
maximlt Feb 4, 2022
8b728db
add module dedicated to transforms and is_interactive_opt util
maximlt Feb 4, 2022
0cf679c
fix test
maximlt Feb 4, 2022
e55f467
remove type hints
maximlt Feb 4, 2022
9be1c19
add backend to opts call
maximlt Feb 17, 2022
ad18eeb
raise an error if an element isn't available from a backend
maximlt Feb 17, 2022
6fb07a9
move opts transformers out from the converter
maximlt Feb 17, 2022
c6bca03
add tests
maximlt Feb 17, 2022
79a14d4
clean up the transforms
maximlt Feb 17, 2022
d2cdd9d
Merge branch 'master' into backend_transformer
maximlt Feb 18, 2022
9c788d8
add opts transforms for networkx plots
maximlt Feb 21, 2022
77ed476
add backend opts transforms to andrews curves and parallel coordinates
maximlt Feb 21, 2022
3d2c491
explicit import error
maximlt Feb 23, 2022
584fa50
remove debug prints
maximlt Feb 23, 2022
4edc989
use Version from packaging in scatter_matrix
maximlt Feb 23, 2022
98a2cc6
Merge branch 'master' into backend_transformer
maximlt Feb 23, 2022
4dc8378
add packaging to the runtime depencies
maximlt Feb 23, 2022
50153c2
fix the tests
maximlt Feb 23, 2022
a11b92f
fix line_dash for matplotlib
maximlt Feb 23, 2022
8af2196
some opts mappings should not return the original value
maximlt Feb 23, 2022
cd75f81
expose render from holoviews
maximlt Feb 25, 2022
31b5bc3
expose extension from holoviews with no logo by default
maximlt Feb 25, 2022
ab9acef
clean up a commented line
maximlt Feb 25, 2022
e10938b
add a backends parameter to entry points
maximlt Feb 25, 2022
6ce3038
totally rework to options test module to run with the 3 backends
maximlt Feb 25, 2022
a49b0e7
add a test for compositeoverlay plots
maximlt Feb 25, 2022
e9a8d36
doc update
maximlt Feb 25, 2022
3c6adb9
notebooks metadata clean up
maximlt Feb 25, 2022
19ac0df
fix plotly notebook
maximlt Feb 25, 2022
bd299df
Merge branch 'master' into backend_transformer
maximlt Feb 25, 2022
a1d6f9d
fix flakes
maximlt Feb 25, 2022
3b793dc
fix notebook flakes
maximlt Feb 25, 2022
9b616d3
add compatibility indirection to better handle styling options with d…
maximlt Mar 2, 2022
62f9212
fix usage of pytest.approx
maximlt Mar 3, 2022
675b27f
fix apply opts transforms call
maximlt Mar 3, 2022
0cf0d86
fix custom opts handling for the current backend
maximlt Mar 3, 2022
43e441a
move hvplot_extension to the utilities module
maximlt Mar 3, 2022
e4615ea
adapt patching the docstring and signature
maximlt Mar 3, 2022
5e51a0d
use hvplot extension in the plotting module
maximlt Mar 3, 2022
e0fdb84
Merge branch 'master' into backend_transformer
maximlt Mar 3, 2022
b7527f4
update the docs
maximlt Mar 22, 2022
3bb792d
rename function that transforms the size to matplotlib
maximlt Mar 22, 2022
2910d24
remove figsize from the signature
maximlt Mar 22, 2022
4de5e2f
Update hvplot/utilities.py
maximlt Mar 25, 2022
9eecf2a
add output alias and backend hook to update compat and docstrings
maximlt Mar 25, 2022
15c77f4
update docs
maximlt Mar 25, 2022
e0ed4fe
Merge branch 'master' into backend_transformer
maximlt Mar 25, 2022
cf7ab64
simplify compatibility handling
maximlt Mar 25, 2022
553201b
update compatibility docstring after suggestion
maximlt Mar 25, 2022
f889457
update docs
maximlt Mar 30, 2022
3709775
Merge branch 'master' into backend_transformer
maximlt Mar 30, 2022
0125c77
update the landing page diagram
maximlt Mar 31, 2022
21fa83f
address suggestions
maximlt Apr 1, 2022
95ad501
add missing sentence
maximlt Apr 1, 2022
1761fc0
Update examples/user_guide/Introduction.ipynb
maximlt Apr 4, 2022
affdc8d
apply suggestions from review
maximlt Apr 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,8 @@ hvplot/.version
# doit
.doit.db

# vscode
.vscode
# IDE
/.vscode

# MacOS
.DS_Store
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
:hidden:
:maxdepth: 2

Introduction <self>
Home <self>
User Guide <user_guide/index>
Reference Gallery <reference/index>
Topics <topics>
Expand Down
18 changes: 15 additions & 3 deletions doc/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ rather than Matplotlib.
* `Introduction <Introduction.html>`_
Introduction to hvPlot and how to start using it.

* `Plotting <Plotting.html>`_
Overview of plotting your data with hvPlot.
* `Plotting with Bokeh <Plotting.html>`_
Overview of plotting your data with hvPlot and Bokeh.

* `Plotting with Matplotlib <Plotting_with_Matplotlib.html>`_
Overview of plotting your data with hvPlot and Matplotib.

* `Plotting with Plotly <Plotting_with_Plotly.html>`_
Overview of plotting your data with hvPlot and Plotly.

* `Customization <Customization.html>`_
Listing of available options to customize plots.
Expand All @@ -53,6 +59,9 @@ rather than Matplotlib.
* `Widgets <Widgets.html>`_
Adding and customizing interactivity using Panel widgets.

* `Plotting Extensions <Plotting_Extensions.html>`_
Changing the plotting extension.

* `Viewing <Viewing.html>`_
Displaying and saving plots in the notebook, at the command prompt, or in scripts.

Expand Down Expand Up @@ -86,10 +95,13 @@ rather than Matplotlib.
:maxdepth: 2

Introduction <Introduction>
Plotting <Plotting>
Plotting with Bokeh <Plotting>
Plotting with Matplotlib <Plotting_with_Matplotlib>
Plotting with Plotly <Plotting_with_Plotly>
Customization <Customization>
Interactive <Interactive>
Widgets <Widgets>
Plotting Extensions <Plotting_Extensions>
Viewing <Viewing>
Subplots <Subplots>
Streaming <Streaming>
Expand Down
Binary file modified examples/assets/diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
795 changes: 744 additions & 51 deletions examples/assets/diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 42 additions & 8 deletions examples/homepage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"**A high-level plotting API for the PyData ecosystem built on HoloViews.**\n",
"\n",
"<img src=\"./assets/diagram.png\" width=\"70%\"></img>\n",
"<img src=\"./assets/diagram.svg\" width=\"70%\"></img>\n",
"\n",
"The PyData ecosystem has a number of core Python data containers that allow users to work with a wide array of datatypes, including:\n",
"\n",
Expand All @@ -21,7 +21,7 @@
"\n",
"Several of these libraries have the concept of a high-level plotting API that lets a user generate common plot types very easily. The native plotting APIs are generally built on [Matplotlib](http://matplotlib.org), which provides a solid foundation, but it means that users miss out on the benefits of modern, interactive plotting libraries built for the web like [Bokeh](http://bokeh.pydata.org) and [HoloViews](http://holoviews.org).\n",
"\n",
"hvPlot provides a high-level plotting API built on HoloViews that provides a general and consistent API for plotting data in all the abovementioned formats. hvPlot can integrate neatly with the individual libraries if an extension mechanism for the native plot APIs is offered, or it can be used as a standalone component. To get started jump straight into the [installation instructions](#installation) and check out the current functionality in the [User Guide.](user_guide/index.html)"
"**hvPlot** provides a high-level plotting API built on HoloViews that provides a general and consistent API for plotting data in all the abovementioned formats. hvPlot can integrate neatly with the individual libraries if an extension mechanism for the native plot APIs is offered, or it can be used as a standalone component. To get started jump straight into the [installation instructions](#installation) and check out the current functionality in the [User Guide.](user_guide/index.html)"
]
},
{
Expand All @@ -30,7 +30,7 @@
"source": [
"## Usage\n",
"\n",
"hvPlot provides an alternative for the static plotting API provided by [Pandas](http://pandas.pydata.org) and other libraries, with an interactive [Bokeh](http://bokeh.pydata.org)-based plotting API that supports panning, zooming, hovering, and clickable/selectable legends:"
"hvPlot provides an alternative for the static plotting API provided by [Pandas](http://pandas.pydata.org) and other libraries, with by default an interactive [Bokeh](http://bokeh.pydata.org)-based plotting API that supports panning, zooming, hovering, and clickable/selectable legends:"
]
},
{
Expand Down Expand Up @@ -160,6 +160,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"hvPlots will show widgets like the \"Time\" slider here whenever your data is indexed by dimensions that are not mapped onto the plot axes, allowing you to explore complex datasets much more easily than with the default plotting support.\n",
maximlt marked this conversation as resolved.
Show resolved Hide resolved
"\n",
"Lastly, hvPlot also provides drop-in replacements for the NetworkX plotting functions, making it trivial to generate interactive plots of [network graphs](user_guide/NetworkX.html):"
]
},
Expand All @@ -181,12 +183,44 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"hvPlots will show widgets like the \"Time\" slider here whenever your data is indexed by dimensions that are not mapped onto the plot axes, allowing you to explore complex datasets much more easily than with the default plotting support.\n",
"\n",
"hvPlot offers the possibility to create [Matplotlib](https://matplotlib.org/) and [Plotly](https://plotly.com/) plots. Switching the underlying plotting library/backend is achieved with the `extension` function."
maximlt marked this conversation as resolved.
Show resolved Hide resolved
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hvplot.extension('matplotlib')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"air_ds.air.isel(time=slice(0, 9, 3)).hvplot.quadmesh(\n",
" 'lon', 'lat', projection=proj, project=True, global_extent=True, \n",
" cmap='viridis', rasterize=True, dynamic=False, coastline=True,\n",
" xaxis=None, yaxis=None, width=500\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"hvPlot is designed to work well in and outside the Jupyter notebook, and thanks to built-in [Datashader](http://datashader.org) support scales easily to millions or even billions of datapoints:\n",
"\n",
"<img src=\"./assets/console_server.gif\" style=\"display: table; margin: 0 auto;\" width=\"80%\"></img>\n",
"\n",
"<img src=\"./assets/console_server.gif\" style=\"display: table; margin: 0 auto;\" width=\"80%\"></img>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For information on using hvPlot take a look at the [User Guide](user_guide/index.html) or the [announcement blog](http://blog.pyviz.org/hvplot_announcement.html).\n",
"\n",
"## Installation\n",
Expand All @@ -196,7 +230,7 @@
"| Latest release | [![Github release](https://img.shields.io/github/release/holoviz/hvplot.svg?label=tag&colorB=11ccbb)](https://github.com/holoviz/hvplot/releases) [![PyPI version](https://img.shields.io/pypi/v/hvplot.svg?colorB=cc77dd)](https://pypi.python.org/pypi/hvplot) [![hvplot version](https://img.shields.io/conda/v/pyviz/hvplot.svg?colorB=4488ff&style=flat)](https://anaconda.org/pyviz/hvplot) [![conda-forge version](https://img.shields.io/conda/v/conda-forge/hvplot.svg?label=conda%7Cconda-forge&colorB=4488ff)](https://anaconda.org/conda-forge/hvplot) [![defaults version](https://img.shields.io/conda/v/anaconda/hvplot.svg?label=conda%7Cdefaults&style=flat&colorB=4488ff)](https://anaconda.org/anaconda/hvplot) |\n",
"| Python | [![Python support](https://img.shields.io/pypi/pyversions/hvplot.svg)](https://pypi.org/project/hvplot/) |\n",
"\n",
"hvPlot supports Python 3.6, 3.7, 3.8 and 3.9 on Linux, Windows, or Mac. The recommended way to install hvPlot is using the [conda](https://conda.io/en/latest/) command provided by [Anaconda](https://docs.anaconda.com/anaconda/install/index.html) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html):\n",
"hvPlot supports Python 3.6, 3.7, 3.8, 3.9 and 3.10 on Linux, Windows, or Mac. The recommended way to install hvPlot is using the [conda](https://conda.io/en/latest/) command provided by [Anaconda](https://docs.anaconda.com/anaconda/install/index.html) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html):\n",
"\n",
" conda install -c pyviz hvplot\n",
"\n",
Expand Down
76 changes: 76 additions & 0 deletions examples/reference/pandas/andrewscurves.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import hvplot.pandas # noqa"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Andrews curves provides a mechanism for visualising clusters of multivariate data.\n",
"\n",
"Andrews curves have the functional form:\n",
"\n",
" f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t) + x_4 sin(2t) + x_5 cos(2t) + ...\n",
"\n",
"Where *x* coefficients correspond to the values of each dimension and *t* is\n",
"linearly spaced between *-pi* and *+pi*. Each row of frame then corresponds to\n",
"a single curve."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from bokeh.sampledata import iris\n",
"\n",
"iris = iris.flowers"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"iris.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hvplot.plotting.andrews_curves(\n",
" iris,\n",
" class_column='species',\n",
" samples=20,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
4 changes: 1 addition & 3 deletions examples/reference/pandas/area.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"from bokeh.sampledata.degrees import data\n",
Expand Down
66 changes: 66 additions & 0 deletions examples/reference/pandas/lagplot.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import hvplot.pandas # noqa\n",
"import numpy as np\n",
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Lag plots are most commonly used to look for patterns in time series data."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Given the following time series:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"np.random.seed(5)\n",
"x = np.cumsum(np.random.normal(loc=1, scale=5, size=50))\n",
"s = pd.Series(x, name='Time series')\n",
"\n",
"s.hvplot()"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this is really related to this PR, but the lack of an x-axis label bothers me. What are the units? Absolute time or presumably time deltas?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the exact same example as pandas' one, which doesn't mean it's perfect!
https://pandas.pydata.org/docs/reference/api/pandas.plotting.lag_plot.html

]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A lag plot with `lag=1` returns:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hvplot.plotting.lag_plot(s, lag=1)"
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
22 changes: 1 addition & 21 deletions examples/reference/pandas/ohlc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,9 @@
}
],
"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.8.8"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
"pygments_lexer": "ipython3"
maximlt marked this conversation as resolved.
Show resolved Hide resolved
}
},
"nbformat": 4,
Expand Down
Loading