Skip to content

Commit

Permalink
Add autorange option (#1128)
Browse files Browse the repository at this point in the history
* Add autorange option

* Add small documentation about autorange

---------

Co-authored-by: Simon Høxbro Hansen <[email protected]>
  • Loading branch information
philippjfr and hoxbro authored Sep 20, 2023
1 parent 0c780ab commit 1ef1e26
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
17 changes: 17 additions & 0 deletions examples/user_guide/Timeseries_Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@
"sst.hvplot(xformatter=formatter)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Auto range\n",
"Automatic auto-ranging on the data in x or y is supported, making it easy to scale the given axes and fit the entire visible curve after a zoom or pan."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sst.hvplot(autorange=\"y\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
8 changes: 7 additions & 1 deletion hvplot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ class HoloViewsConverter:
"""
Generic options
---------------
autorange (default=None): Literal['x', 'y'] | None
Whether to enable auto-ranging along the x- or y-axis when
zooming.
clim: tuple
Lower and upper bound of the color scale
cnorm (default='linear'): str
Expand Down Expand Up @@ -383,7 +386,8 @@ def __init__(
y_sampling=None, project=False, tools=[], attr_labels=None,
coastline=False, tiles=False, sort_date=True,
check_symmetric_max=1000000, transforms={}, stream=None,
cnorm=None, features=None, rescale_discrete_levels=None, **kwds
cnorm=None, features=None, rescale_discrete_levels=None,
autorange=None, **kwds
):
# Process data and related options
self._redim = fields
Expand Down Expand Up @@ -485,6 +489,8 @@ def __init__(
if ylim is not None:
plot_opts['ylim'] = tuple(ylim)

plot_opts['autorange'] = autorange

self.invert = invert
if loglog is not None:
logx = logx or loglog
Expand Down

0 comments on commit 1ef1e26

Please sign in to comment.