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

Problem with ship_traffic legend #279

Open
rsignell-usgs opened this issue Jun 13, 2023 · 9 comments
Open

Problem with ship_traffic legend #279

rsignell-usgs opened this issue Jun 13, 2023 · 9 comments

Comments

@rsignell-usgs
Copy link

rsignell-usgs commented Jun 13, 2023

I'm guessing something changed with one of the packages, because when I run the interactive ship traffic cell, I get two legends. The first one is coming from the points datashader object but I can't figure out how to turn it off! Help @jlstevens !

ship_traffic

@jlstevens
Copy link
Contributor

I have noticed this and this is part of the work I am actively working on right now - hoping to get this fixed soon.

@rsignell-usgs
Copy link
Author

Is there a workaround? I'd love to give a live demo tomorrow during my final presentation here at NATO CMRE in Italy, 11:00 Italy time.

@jlstevens
Copy link
Contributor

I'll have a look this evening.

This legend is already generated with a workaround so I don't expect it will be hard to hide (or simply filter out) those annoying numbers (which is probably the correct thing to do tbh as the vessel types are supposed to be grouped into the named categories)

@jlstevens
Copy link
Contributor

jlstevens commented Jun 14, 2023

Here is the simple fix I've found so far:

tiles * labels * points.opts(show_legend=False) * legend.opts(xaxis='bare',yaxis='bare', title='')

Looks like points now gets an automatic legend which merges with the custom one.

@jlstevens
Copy link
Contributor

@rsignell-usgs I've updated the deployment to fix the legend and which also includes some new hover functionality (WIP): https://ship-traffic.pyviz.demo.anaconda.com/ship_traffic

@jbednar
Copy link
Contributor

jbednar commented Jun 15, 2023

I just had to discover a similar fix for the Census example. Seems like the automatic legend (which I totally don't remember us implementing!) needs a way to pass a mapping from category value (12) to category name (Tug). legend_mapping={12:"Tug", ...}?

@rsignell-usgs
Copy link
Author

@jlstevens , awesome! Just in time for my live demo!!!!

@jlstevens
Copy link
Contributor

I think that a mapping option would make sense!

When using categorical datashader operations in holoviews, I would hope we don't need the mapping as we would set the names explicitly.

@jlstevens
Copy link
Contributor

@hoxbro @jbednar I think the legend_mapping suggestion makes sense as an override.

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

No branches or pull requests

3 participants