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

See Explorer output code within a tab #1156

Merged
merged 72 commits into from Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
3af4174
Enhancement to Geo tab in explorer
hoxbro Jul 30, 2022
5242f88
Naming the geo_controls
hoxbro Aug 1, 2022
eefcc28
Merge branch 'master' into explorer_enhancement_geo
hoxbro Aug 4, 2022
433100f
Only setting default value if not set
hoxbro Aug 4, 2022
734c6c9
Merge branch 'main' into explorer_enhancement_geo
hoxbro Sep 11, 2023
997375a
DEBUG: Try to fix failing tests
hoxbro Sep 13, 2023
7b90c56
Try without pin
hoxbro Sep 13, 2023
ba21dc9
Step towards implementing xarray explorer
ahuang11 Sep 16, 2023
69854e0
Group by kinds and add auto refresh
ahuang11 Sep 18, 2023
7ef37a0
Fix layout and by
ahuang11 Sep 18, 2023
a8c6a51
Add back geo
ahuang11 Sep 18, 2023
d7323ca
Tweak y_multi
ahuang11 Sep 19, 2023
cc1d8d2
Fix missing kwarg
ahuang11 Sep 19, 2023
ac94126
Add tests
ahuang11 Sep 21, 2023
4279754
Add more tests
ahuang11 Sep 21, 2023
c04f38e
Improve defaults
ahuang11 Sep 21, 2023
d4144e2
Fix geo
ahuang11 Sep 21, 2023
a7e6da7
Prevent class name conflict with kwarg geo and fix tests
ahuang11 Sep 21, 2023
4ffcfa0
Add docs
ahuang11 Sep 26, 2023
92605c7
Improve default
ahuang11 Sep 26, 2023
67f3cbf
Add code tab
ahuang11 Sep 26, 2023
006f997
Fix tests
ahuang11 Sep 27, 2023
8f7be4d
Refactor into param, add tests, docs
ahuang11 Sep 27, 2023
59d9b39
Update hvplot/ui.py
ahuang11 Sep 27, 2023
a0eb5f5
Add another test and fix
ahuang11 Sep 27, 2023
2cd9a10
Support plots that use `by` with `rasterize` with hv.ImageStack (#1132)
ahuang11 Sep 19, 2023
ba9eb92
Handle wkt format (#1092)
hoxbro Sep 19, 2023
98c2612
Add version check for test (#1144)
ahuang11 Sep 19, 2023
8923efe
Param 2: don't call param.objects() before `super().__init__` in the …
maximlt Sep 20, 2023
4a9b8d2
Add autorange option (#1128)
philippjfr Sep 20, 2023
dcbf12a
Expose timeseries downsampling as an option (#1127)
philippjfr Sep 20, 2023
13ef34c
Fixing conda package build (#1148)
hoxbro Sep 20, 2023
99ec889
Step towards implementing xarray explorer
ahuang11 Sep 16, 2023
9180fec
Group by kinds and add auto refresh
ahuang11 Sep 18, 2023
a15b3ee
Fix layout and by
ahuang11 Sep 18, 2023
6f9dd57
Add back geo
ahuang11 Sep 27, 2023
79e65d8
Tweak y_multi
ahuang11 Sep 19, 2023
c497f76
Fix missing kwarg
ahuang11 Sep 19, 2023
c6bcfb9
Add tests
ahuang11 Sep 21, 2023
3afd3d6
Add more tests
ahuang11 Sep 21, 2023
1c05554
Improve defaults
ahuang11 Sep 27, 2023
e7073c5
Fix geo
ahuang11 Sep 21, 2023
40395de
Prevent class name conflict with kwarg geo and fix tests
ahuang11 Sep 21, 2023
92efd95
Add docs
ahuang11 Sep 26, 2023
ab4fa59
Improve default
ahuang11 Sep 26, 2023
1ae0a16
Fix tests
ahuang11 Sep 27, 2023
5b3d408
Tweaks to removing geo kwargs
ahuang11 Sep 27, 2023
b107912
Merge branch 'hvplot_gridded_explorer' into explorer_code
ahuang11 Sep 27, 2023
0db60c9
Remove merge accident
ahuang11 Sep 27, 2023
616e825
Merge branch 'main' into hvplot_gridded_explorer
ahuang11 Sep 27, 2023
afb421c
Fix merge issues
ahuang11 Sep 27, 2023
d93b211
Fix tests
ahuang11 Sep 27, 2023
9d2c122
Add dropped test
ahuang11 Sep 27, 2023
186900e
Add var name suffix
ahuang11 Sep 28, 2023
aa82736
Remove print
ahuang11 Sep 28, 2023
517bfbf
Refactor refresh
ahuang11 Oct 1, 2023
14ec6d6
Fix auto refresh plot
ahuang11 Oct 1, 2023
71d4fe1
Pop refresh plot
ahuang11 Oct 1, 2023
ab7cb89
Disable all geo keys
ahuang11 Oct 1, 2023
bdfcd3f
Fix test
ahuang11 Oct 1, 2023
3cf7742
Watch _refresh instead of _plot
ahuang11 Oct 1, 2023
35060b4
Refactor refresh_plot and link
ahuang11 Oct 1, 2023
bb5a5d7
Fix test
ahuang11 Oct 1, 2023
dd1a00e
Merge branch 'main' into hvplot_gridded_explorer
ahuang11 Oct 1, 2023
b7ea90f
Merge branch 'hvplot_gridded_explorer' into explorer_code
ahuang11 Oct 1, 2023
7db9198
Update hvplot/ui.py
ahuang11 Oct 1, 2023
8dee660
Update hvplot/ui.py
ahuang11 Oct 8, 2023
33e9c2c
Update hvplot/ui.py
maximlt Oct 9, 2023
4e9a946
Fix tests
ahuang11 Oct 9, 2023
48f4255
Merge branch 'main' into explorer_code
maximlt Oct 12, 2023
bae32ef
remove the import from code
maximlt Oct 12, 2023
f67106b
docs cleanup after bad merge
maximlt Oct 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
93 changes: 91 additions & 2 deletions examples/user_guide/Explorer.ipynb
Expand Up @@ -8,6 +8,7 @@
"source": [
"import hvplot.pandas\n",
"\n",
"import xarray as xr\n",
"from bokeh.sampledata.penguins import data as df"
]
},
Expand All @@ -16,12 +17,13 @@
"metadata": {},
"source": [
"<div class=\"alert alert-info\" role=\"info\">\n",
" The Explorer has been added to hvPlot in version <code>0.8.0</code>, and improved and documented in version <code>0.8.1</code>. It does not yet support all the data structures supported by hvPlot, for now it works best with Pandas DataFrame objects. Please report any issue or feature request <a href='https://github.com/holoviz/hvplot/'>on GitHub</a>.\n",
" The Explorer has been added to hvPlot in version <code>0.8.0</code>, and improved and documented in version <code>0.8.1</code> and <code>0.8.5</code>. It does not yet support all the data structures supported by hvPlot. Please report any issue or feature request <a href='https://github.com/holoviz/hvplot/'>on GitHub</a>.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "bd5ab787",
"metadata": {},
"source": [
"hvPlot API provides a simple and intuitive way to create plots. However when you are exploring data you don't always know in advance the best way to display it, or even what kind of plot would be best to visualize the data. You will very likely embark in an iterative process that implies choosing a kind of plot, setting various options, running some code, and repeat until you're satisfied with the output and the insights you get. The *Explorer* is a *Graphical User Interface* that allows you to easily generate customized plots, which in practice gives you the possibility to **explore** both your data and hvPlot's extensive API.\n",
Expand All @@ -34,6 +36,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6d36b75a",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -68,7 +71,7 @@
"metadata": {},
"outputs": [],
"source": [
"hvexplorer.param.set_param(kind='scatter', x='bill_length_mm', y_multi=['bill_depth_mm'], by=['species'])\n",
"hvexplorer.param.update(kind='scatter', x='bill_length_mm', y_multi=['bill_depth_mm'], by=['species'])\n",
"hvexplorer.labels.title = 'Penguins Scatter'"
]
},
Expand Down Expand Up @@ -121,6 +124,14 @@
"df.hvplot(**settings)"
]
},
{
"cell_type": "markdown",
"id": "be5f3cc6",
"metadata": {},
"source": [
"Or you can simply copy/paste the code displayed under the `Code` tab."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -139,6 +150,7 @@
},
{
"cell_type": "markdown",
"id": "76c92eaf",
"metadata": {},
"source": [
"Copy/pasting this string without the outer quotes into the next cell is all you need to recreate the exact same plot."
Expand All @@ -153,6 +165,83 @@
"df.hvplot(by=['species'], kind='scatter', title='Penguins Scatter', x='bill_length_mm', y=['bill_depth_mm'])"
]
},
{
"cell_type": "markdown",
"id": "b986b42d",
"metadata": {},
"source": [
"You may also call `hvplot` on the explorer instance."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "db9ada50",
"metadata": {},
"outputs": [],
"source": [
"hvexplorer.hvplot()"
]
},
{
"cell_type": "markdown",
"id": "8c183122",
"metadata": {},
"source": [
"It also works for xarray objects."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f15dde1f",
"metadata": {},
"outputs": [],
"source": [
"ds = xr.tutorial.open_dataset(\"air_temperature\")\n",
"\n",
"hvplot.explorer(ds, x=\"lon\", y=\"lat\")"
]
},
{
"cell_type": "markdown",
"id": "d6d90743",
"metadata": {},
"source": [
"It's also possible to geographically reference the data, with cartopy and geoviews installed."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "87d4ab4f",
"metadata": {},
"outputs": [],
"source": [
"hvexplorer = hvplot.explorer(ds, x=\"lon\", y=\"lat\", geo=True)\n",
"hvexplorer.geographic.param.update(crs=\"PlateCarree\", tiles=\"CartoDark\")\n",
"hvexplorer"
]
},
{
"cell_type": "markdown",
"id": "c4736831",
"metadata": {},
"source": [
"Large datasets can be plotted efficiently using Datashader's `rasterize`."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d01077b1",
"metadata": {},
"outputs": [],
"source": [
"hvexplorer = hvplot.explorer(ds, x=\"lon\", y=\"lat\", rasterize=True)\n",
"hvexplorer"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
4 changes: 2 additions & 2 deletions hvplot/converter.py
Expand Up @@ -671,12 +671,12 @@ def _process_crs(self, data, crs):

try:
return process_crs(_crs)
except ValueError:
except ValueError as e:
# only raise error if crs was specified in kwargs
if crs:
raise ValueError(
f"'{crs}' must be either a valid crs or an reference to "
"a `data.attr` containing a valid crs.")
f"a `data.attr` containing a valid crs: {e}")

def _process_data(self, kind, data, x, y, by, groupby, row, col,
use_dask, persist, backlog, label, group_label,
Expand Down