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

Add tiles_opts parameter to customize the tiles #1299

Merged
merged 4 commits into from
Apr 8, 2024
Merged

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Mar 26, 2024

Addresses #1293

An alternative implementation might have been overloading tiles to accept a dictionary like {"tiles": "ESRI", "alpha": 0.5}. Interested in what other maintainers think about the two different approaches.

@ahuang11
Copy link
Collaborator

tiles_opts follows convention of what other keywords do:
legend_opts colorbar_opts

@maximlt
Copy link
Member Author

maximlt commented Mar 27, 2024

Yes although these two keywords aren't hvPlot parameters but HoloViews plot options. The features parameter of hvPlot can be overloaded:

features (default=None): dict or list
    A list of features or a dictionary of features and the scale
    at which to render it. Available features include 'borders',
    'coastline', 'lakes', 'land', 'ocean', 'rivers' and 'states'.
    Available scales include '10m'/'50m'/'110m'.

It's because of this parameter I thought that maybe tiles could also be overloaded, instead of adding tiles_opts, as hvPlot suffers more from new parameters added to its flat signature than HoloViews. Perhaps with something like:

  • tiles={"alpha":0.5} (== tiles=True, tiles_opts={"alpha": 0.5})
  • tiles={"tiles": "ESRI", "alpha": 0.5} (== tiles="ESRI", tiles_opts={"alpha": 0.5})

I think in the end I have a slight preference for tiles_opts. Opinions @philippjfr @hoxbro ?

@ahuang11
Copy link
Collaborator

ahuang11 commented Mar 27, 2024

tiles={"tiles": "ESRI", "alpha": 0.5} is funky (the key matches the outer key); if dict, I think
tiles={"name": "ESRI", "alpha": 0.5} would be more suitable or even tiles=("ESRI", {"alpha": 0.5}), but yes I lean towards tiles_opts or tiles_kwargs

@hoxbro
Copy link
Member

hoxbro commented Mar 27, 2024

I like tiles_opts too.

@philippjfr
Copy link
Member

+1 on tiles_opts.

hvplot/converter.py Outdated Show resolved Hide resolved
Co-authored-by: Andrew <15331990+ahuang11@users.noreply.github.com>
@maximlt maximlt merged commit eab14f0 into main Apr 8, 2024
9 checks passed
@maximlt maximlt deleted the add_tiles_opts branch April 8, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants