Skip to content

Commit

Permalink
Merge branch 'main' into optimize_wide_data
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt committed Jun 27, 2024
2 parents 1e61065 + a56c997 commit e53a4d2
Show file tree
Hide file tree
Showing 27 changed files with 225 additions and 346 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: install
run: pip install ."[doc, examples, geo]"
run: pip install -v --prefer-binary -e ."[doc, examples, geo]"
- name: install dev nbsite
run: pip install --pre -U nbsite
- name: pip list
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ jobs:
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"python-version": ["3.8", "3.12"],
"python-version": ["3.9", "3.12"],
"exclude": [
{
"python-version": "3.8",
"python-version": "3.9",
"os": "macos-latest"
}
]
Expand All @@ -74,7 +74,7 @@ jobs:
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"python-version": ["3.8", "3.12"],
"python-version": ["3.9", "3.12"],
"include": [
{
"python-version": "3.9",
Expand All @@ -91,7 +91,7 @@ jobs:
],
"exclude": [
{
"python-version": "3.8",
"python-version": "3.9",
"os": "macos-latest"
}
]
Expand Down Expand Up @@ -159,13 +159,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: upgrade pip / setuptools
run: pip install -U pip setuptools
- name: install without geo
# Because cartopy cannot be installed on Python 3.8 on these platforms
if: matrix.python-version == '3.8' && contains(fromJSON('["ubuntu-latest", "windows-latest"]'), matrix.os)
run: pip install -ve '.[tests, examples-tests, hvdev, dev-extras]'
- name: install with geo
if: matrix.python-version != '3.8' || !contains(fromJSON('["ubuntu-latest", "windows-latest"]'), matrix.os)
run: pip install -ve '.[tests, examples-tests, geo, hvdev, hvdev-geo, dev-extras]'
run: pip install -v --prefer-binary -e '.[tests, examples-tests, geo, hvdev, hvdev-geo, dev-extras]'
- name: pip list
run: pip list
- name: bokeh sampledata
Expand Down
2 changes: 1 addition & 1 deletion doc/developer_guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ source .venv/bin/activate
Install the test dependencies:

``` bash
pip install -e '.[tests, examples-tests, geo, hvdev, hvdev-geo, dev-extras]'
pip install --prefer-binary -e '.[tests, examples-tests, geo, hvdev, hvdev-geo, dev-extras]'
```

:::
Expand Down
2 changes: 1 addition & 1 deletion doc/getting_started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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) |
| Python | [![Python support](https://img.shields.io/pypi/pyversions/hvplot.svg)](https://pypi.org/project/hvplot/) |

hvPlot supports Python 3.8 and above on Linux, Windows, or Mac. hvPlot can be installed with [conda](https://conda.io/en/latest/):
hvPlot supports Python 3.9 and above on Linux, Windows, or Mac. hvPlot can be installed with [conda](https://conda.io/en/latest/):

conda install hvplot

Expand Down
80 changes: 80 additions & 0 deletions doc/reference/pandas/paths.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Paths"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import hvplot.pandas # noqa\n",
"import cartopy.crs as ccrs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Paths are useful if you are plotting lines on a geographic map."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df = pd.DataFrame({\"city\": [\"NY\", \"Delhi\"], \"lon\": [-75, 77.23], \"lat\": [43, 28.61]})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notice how the line in blue between New York and Delhi is not straight on a flat PlateCarree map, this is because the Geodetic coordinate system is a truly spherical coordinate system, where a line between two points is defined as the shortest path between those points on the globe rather than 2d Cartesian space."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"common_kwargs = dict(\n",
" x=\"lon\",\n",
" y=\"lat\",\n",
" geo=True,\n",
" project=True,\n",
" projection=ccrs.GOOGLE_MERCATOR,\n",
" global_extent=True\n",
")\n",
"shortest_path = df.hvplot.paths(color=\"blue\", crs=ccrs.Geodetic(), tiles=True, **common_kwargs)\n",
"straight_path = df.hvplot.paths(color=\"grey\", line_dash=\"dashed\", **common_kwargs)\n",
"labels = df.hvplot.labels(text_color=\"black\", text=\"city\", **common_kwargs)\n",
"shortest_path * straight_path * labels"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Example adapted from https://scitools.org.uk/cartopy/docs/latest/matplotlib/intro.html."
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
27 changes: 27 additions & 0 deletions doc/user_guide/Customization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,29 @@
" Aggregator to use when applying rasterize or datashade operation\n",
" (valid options include 'mean', 'count', 'min', 'max' and more, and\n",
" datashader reduction objects)\n",
" downsample (default=False):\n",
" Controls the application of downsampling to the plotted data,\n",
" which is particularly useful for large timeseries datasets to\n",
" reduce the amount of data sent to browser and improve\n",
" visualization performance. Requires HoloViews >= 1.16. Additional\n",
" dependencies: Installing the `tsdownsample` library is required\n",
" for using any downsampling methods other than the default 'lttb'.\n",
" Acceptable values:\n",
" - False: No downsampling is applied.\n",
" - True: Applies downsampling using HoloViews' default algorithm\n",
" (LTTB - Largest Triangle Three Buckets).\n",
" - 'lttb': Explicitly applies the Largest Triangle Three Buckets\n",
" algorithm.\n",
" - 'minmax': Applies the MinMax algorithm, selecting the minimum\n",
" and maximum values in each bin. Requires `tsdownsample`.\n",
" - 'm4': Applies the M4 algorithm, selecting the minimum, maximum,\n",
" first, and last values in each bin. Requires `tsdownsample`.\n",
" - 'minmax-lttb': Combines MinMax and LTTB algorithms for\n",
" downsampling, first applying MinMax to reduce to a preliminary\n",
" set of points, then LTTB for further reduction. Requires\n",
" `tsdownsample`.\n",
" Other string values corresponding to supported algorithms in\n",
" HoloViews may also be used.\n",
" dynamic (default=True):\n",
" Whether to return a dynamic plot which sends updates on widget and\n",
" zoom/pan events or whether all the data should be embedded\n",
Expand All @@ -168,6 +191,10 @@
" rasterize (default=False):\n",
" Whether to apply rasterization using the datashader library\n",
" returning an aggregated Image\n",
" resample_when (default=None):\n",
" Applies a resampling operation (datashade, rasterize or downsample) if\n",
" the number of individual data points present in the current zoom range\n",
" is above this threshold. The raw plot is displayed otherwise.\n",
" x_sampling/y_sampling (default=None):\n",
" Specifies the smallest allowed sampling interval along the x/y axis."
]
Expand Down
23 changes: 23 additions & 0 deletions doc/user_guide/Large_Timeseries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,29 @@
" min_height=300, autorange='y', title=\"Datashader Rasterize\", colorbar=False, line_width=2)"
]
},
{
"cell_type": "markdown",
"id": "5a98e727",
"metadata": {},
"source": [
"### Rasterize Conditionally\n",
"\n",
"Alternatively, it's possible to activate `rasterize` *conditionally* with `resample_when`.\n",
"\n",
"When the number of individual data points present in the current zoom range is below the provided threshold, the raw plot is displayed; otherwise the `rasterize`, `datashade`, or `downsample` operation is applied."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "12910d8e",
"metadata": {},
"outputs": [],
"source": [
"df0.hvplot(x=\"time\", y=\"value\", rasterize=True, resample_when=1000, cnorm='eq_hist', padding=(0, 0.1),\n",
" min_height=300, autorange='y', title=\"Datashader Rasterize\", colorbar=False, line_width=2)"
]
},
{
"cell_type": "markdown",
"id": "naughty-adventure",
Expand Down
2 changes: 1 addition & 1 deletion doc/user_guide/NetworkX.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
"print(\"source vertex {target:length, }\")\n",
"for v in G.nodes():\n",
" spl = dict(nx.single_source_shortest_path_length(G, v))\n",
" print('{} {} '.format(v, spl))\n",
" print(f'{v} {spl} ')\n",
" for p in spl:\n",
" pathlengths.append(spl[p])\n",
"\n",
Expand Down
10 changes: 5 additions & 5 deletions envs/py3.10-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ channels:
- conda-forge
dependencies:
- python=3.10
- bokeh>=1.0.0
- bokeh>=3.1
- cartopy
- colorcet>=2
- dask
Expand All @@ -26,7 +26,7 @@ dependencies:
- geodatasets>=2023.12.0
- geopandas
- geoviews-core>=1.9.0
- holoviews>=1.11.0
- holoviews>=1.19.0
- ibis-duckdb
- intake-parquet>=0.2.3
- intake-xarray>=0.5.0
Expand All @@ -38,10 +38,10 @@ dependencies:
- networkx>=2.6.3
- notebook>=5.4
- numba>=0.51.0
- numpy>=1.15
- numpy>=1.21
- packaging
- pandas
- panel>=0.11.0
- pandas>=1.3
- panel>=1.0
- param<3.0,>=1.12.0
- parameterized
- pillow>=8.2.0
Expand Down
10 changes: 5 additions & 5 deletions envs/py3.11-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ channels:
- conda-forge
dependencies:
- python=3.11
- bokeh>=1.0.0
- bokeh>=3.1
- cartopy
- colorcet>=2
- dask>=2021.3.0
Expand All @@ -25,7 +25,7 @@ dependencies:
- geodatasets>=2023.12.0
- geopandas
- geoviews-core>=1.9.0
- holoviews>=1.11.0
- holoviews>=1.19.0
- ibis-duckdb
- intake-parquet>=0.2.3
- intake-xarray>=0.5.0
Expand All @@ -37,10 +37,10 @@ dependencies:
- networkx>=2.6.3
- notebook>=5.4
- numba>=0.51.0
- numpy>=1.15
- numpy>=1.21
- packaging
- pandas
- panel>=0.11.0
- pandas>=1.3
- panel>=1.0
- param<3.0,>=1.12.0
- pillow>=8.2.0
- plotly
Expand Down
10 changes: 5 additions & 5 deletions envs/py3.11-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ channels:
- conda-forge
dependencies:
- python=3.11
- bokeh>=1.0.0
- bokeh>=3.1
- cartopy
- colorcet>=2
- dask
Expand All @@ -26,7 +26,7 @@ dependencies:
- geodatasets>=2023.12.0
- geopandas
- geoviews-core>=1.9.0
- holoviews>=1.11.0
- holoviews>=1.19.0
- ibis-duckdb
- intake-parquet>=0.2.3
- intake-xarray>=0.5.0
Expand All @@ -38,10 +38,10 @@ dependencies:
- networkx>=2.6.3
- notebook>=5.4
- numba>=0.51.0
- numpy>=1.15
- numpy>=1.21
- packaging
- pandas
- panel>=0.11.0
- pandas>=1.3
- panel>=1.0
- param<3.0,>=1.12.0
- parameterized
- pillow>=8.2.0
Expand Down
10 changes: 5 additions & 5 deletions envs/py3.12-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ channels:
- conda-forge
dependencies:
- python=3.12
- bokeh>=1.0.0
- bokeh>=3.1
- cartopy
- colorcet>=2
- dask
Expand All @@ -26,7 +26,7 @@ dependencies:
- geodatasets>=2023.12.0
- geopandas
- geoviews-core>=1.9.0
- holoviews>=1.11.0
- holoviews>=1.19.0
- ibis-duckdb
- intake-parquet>=0.2.3
- intake-xarray>=0.5.0
Expand All @@ -38,10 +38,10 @@ dependencies:
- networkx>=2.6.3
- notebook>=5.4
- numba>=0.51.0
- numpy>=1.15
- numpy>=1.21
- packaging
- pandas
- panel>=0.11.0
- pandas>=1.3
- panel>=1.0
- param<3.0,>=1.12.0
- parameterized
- pillow>=8.2.0
Expand Down
Loading

0 comments on commit e53a4d2

Please sign in to comment.