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 labels functionality #98

Merged
merged 3 commits into from
Oct 30, 2018
Merged

Add labels functionality #98

merged 3 commits into from
Oct 30, 2018

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Oct 19, 2018

image
Couldn't figure out color_index / size_index though because the underlying hv.Labels encounters some issue I've never seen before...

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

np.random.seed(9)
data = np.random.rand(10, 2)
text = [chr(65+i) for i in range(10)]
# points = hv.Points(data)
# labels = hv.Labels({('x', 'y'): data, 'text': text}, ['x', 'y'], 'text').options(
#     text_font_size='10pt', xoffset=0.08
# )

# (points.options(color='black', size=5) * labels).redim.range(x=(-0.2, 1.2), y=(-.2, 1.2))

df = pd.DataFrame(data)
df.columns = ['x', 'y']
df['text'] = text
df['color'] = range(len(df))

df.hvplot.labels('x', 'y', 'text', c='color')

hv.Labels(df, ['x', 'y'], ['text', 'color']).options(color_index='color')

@ahuang11 ahuang11 mentioned this pull request Oct 19, 2018
@philippjfr
Copy link
Member

I'll have a look at the colors issue.

@philippjfr
Copy link
Member

The color issue appears to be a bug in holoviews LabelPlot.

@philippjfr
Copy link
Member

I'll leave this PR until that is fixed in holoviews.

@philippjfr
Copy link
Member

There's now a fix in holoviews so I'll merge soon.

@philippjfr philippjfr merged commit bd891a1 into master Oct 30, 2018
@philippjfr philippjfr deleted the add_labels branch November 10, 2018 02:32
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

2 participants