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

Legend not working for hv.Graph elements #3509

Open
bstadlbauer opened this issue Feb 21, 2019 · 3 comments
Open

Legend not working for hv.Graph elements #3509

bstadlbauer opened this issue Feb 21, 2019 · 3 comments
Labels
type: enhancement Minor feature or improvement to an existing feature
Milestone

Comments

@bstadlbauer
Copy link

bstadlbauer commented Feb 21, 2019

When creating a hv.Points plot the following would create a legend:

import numpy as np
import holoviews as hv
hv.extension('bokeh')

a = hv.Points(((1, 2), (2, 3)))
a = a.relabel(label='foo')
b = a.relabel(label='bar')
a * b

bokeh_plot 2

However, the same seems not to be true for hv.Graph elements:

N = 8
node_indices = np.arange(N)
source = np.zeros(N)
target = node_indices

padding = dict(x=(-1.2, 1.2), y=(-1.2, 1.2))

graph_a = hv.Graph(((source, target),)).redim.range(**padding)
graph_a = graph_a.relabel('foo')
graph_b = graph_a.relabel('bar')
graph_a * graph_b

bokeh_plot 1

Is this an issue or is there any other way to create an interactive bokeh legend?

@philippjfr philippjfr added the type: enhancement Minor feature or improvement to an existing feature label Feb 21, 2019
@philippjfr
Copy link
Member

Is this an issue or is there any other way to create an interactive bokeh legend?

It is an issue and thanks for filing it (I forgot the last time I ran into this). HoloViews mostly relies on the figure glyph methods to generate legends and it seems the graph method does not auto-generate a legend. The easiest thing to do will be to add the legend manually in GraphPlot.

@philippjfr philippjfr added this to the v1.12.0 milestone Feb 21, 2019
@bstadlbauer
Copy link
Author

Thank you!
@philippjfr Is there any place where I can help? If I know where to implement it (e.g. an example of another element adding a legend) I am happy to make a PR

@philippjfr
Copy link
Member

I don't think there's anything in HoloViews you could copy, I think you'd have to look into what bokeh does internally to create a legend and then copy that approach for Graphs, or possibly a better approach would be to add support for it directly at the bokeh level.

@philippjfr philippjfr modified the milestones: v1.12.0, v1.12.x Mar 22, 2019
@philippjfr philippjfr modified the milestones: v1.12.x, v1.13.0 Jan 5, 2020
@philippjfr philippjfr modified the milestones: v1.13.0, v1.13.x Jan 14, 2020
@philippjfr philippjfr modified the milestones: v1.14.x, v2.0 May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants