-
-
Notifications
You must be signed in to change notification settings - Fork 113
Description
There are a number of keywords that accept a set of values (usually strings). In HoloViews, they are usually declared in a Selector Parameter, so they are more organized and more exposed than in hvPlot which doesn't use Param.
Here's a non-exhaustive list:
Customization:
- xaxis/yaxis: e.g. top, bottom, right, left
- legend: top, bottom, right, left
- tools: e.g. tap, box_select
- hover: vline, hline
- widget_location
Downsampling:
- aggregator: e.g. mean, count, min, max,
- downsample: e.g. lttb, minmax, m4
Geographic:
- coastline: e.g. 10m, 50m
- features: e.g. borders, lakes
I would like to discuss whether having them available as Enums in hvPlot would help improve the user experience. As suggested by @ahuang11, if we were to rely on Enums they should probably be first added to HoloViews. Here's the sort of change we could make in HoloViews, adding an Enum for legend_position and updating the Parameter in a way that doesn't change it at all.
# holoviews/plotting/enums.py
from enum import Enum
import param
class LEGEND_POSITION(str, Enum):
TOP_RIGHT = 'top_right'
TOP_LEFT = 'top_left'
BOTTOM_LEFT = 'bottom_left'
RIGHT = 'right'
LEFT = 'left'
TOP = 'top'
BOTTOM = 'bottom'
# HoloViews plotting modules
class Element(param.Parameterized):
legend_position = param.Selector(objects=[member.value for member in LEGEND_POSITION])hvPlot could expose the Enums in its top-level module.
# hvplot.__init__.py
from hv.plotting.enums import LEGEND_POSITION as LEGENDSo users can leverage them easily:
# USER CODE
import hvplot.pandas
from bokeh.sampledata.penguins import data as df
df.hvplot.scatter(x='bill_length_mm', y='bill_depth_mm', by='species', legend=hvplot.LEGEND.TOP_RIGHT)