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

Update dynamically computed signature #1480

Open
5 tasks
maximlt opened this issue Jan 27, 2025 · 0 comments
Open
5 tasks

Update dynamically computed signature #1480

maximlt opened this issue Jan 27, 2025 · 0 comments
Assignees
Milestone

Comments

@maximlt
Copy link
Member

maximlt commented Jan 27, 2025

The signature of each plotting method is dynamically constructed on import. They include:

  1. Original method signature (e.g. of .line()) without variadic keywords
  2. Valid backend style options for the element (obtained _kind_mapping) and backend (defaults to bokeh)
  3. From the mapping HoloViewsConverter._kind_options (plotting method name to a short list of options)
  4. From the mapping HoloViewsConverter._axis_options (list of axis options)
  5. From the mapping HoloViewsConverter._op_options (list of operation options)
  6. **kwargs

2), 3), 4) and 5) are only built as inspect.Parameter(k, inspect.Parameter.KEYWORD_ONLY) so they don't include the default values of these options, that could, for example, be defined in HoloViewsConverter.__init__.

Many options are in fact missing, here's the list obtained by comparing the signature of HoloViewsConverter.__init__ with hvplot.plotting.hvTabular.line:

attr_labels
autorange
backlog
by
check_symmetric_max
clim
cnorm
coastline
col
crs
cticks
debug
dynamic
dynspread
features
fields
flip_xaxis
flip_yaxis
framewise
geo
global_extent
group_label
groupby
hover
hover_cols
hover_formatters
hover_tooltips
kind
kwds
label
persist
precompute
project
projection
rescale_discrete_levels
robust
row
sort_date
stacked
stream
subplots
symmetric
tiles
tiles_opts
tools
transforms
use_dask
use_index
value_label

Most of these options should be added to the signature with their default value (not all, e.g. kind).

  • Add missing options to the method signature

Despite these missing options, the signature of .line() includes 95 members. 47 of them are style options (e.g. hover_line_dash_offset), this group of options being shown in the second position in the signature. 95 is a really high number of keywords, and is nothing compared to e.g. .heatmap() with its 217 style options for a total of 268 keyword arguments !

  • Style options should be put last
  • See if there's an easy way to reduce the number of these style options for some. It is likely no one ever used hover_line_dash_offset with hvPlot (it's undocumented in hvPlot and in HoloViews), should we keep it?
  • Even reduced, there will still be a pretty large number of keywords (for comparison, pd.read_csv has 49). Sorting them by name isn't an option, it would be really messy. Some grouping is already in place, let's see if we can improve that.
  • Geographic options should be added when relevant.
@maximlt maximlt changed the title Add missing options to the dynamically computed signature Update dynamically computed signature Jan 27, 2025
@maximlt maximlt self-assigned this Feb 5, 2025
@maximlt maximlt added this to the v0.11.3 milestone Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant