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

Automatically mapping markers to category #6380

Open
ahuang11 opened this issue Sep 19, 2024 · 1 comment
Open

Automatically mapping markers to category #6380

ahuang11 opened this issue Sep 19, 2024 · 1 comment
Labels
TRIAGE Needs triaging

Comments

@ahuang11
Copy link
Collaborator

ahuang11 commented Sep 19, 2024

I'd like to map category without manually setting marker

import numpy as np
import holoviews as hv
from holoviews import dim, opts

hv.extension('bokeh')

data = {
    'x values': [0, 1, 0.5],
    'y values': [1, 0, 0.5],
    'alpha': [0.5, 1, 0.3],
    'color': ['red', 'blue', 'green'],
    'marker': ['circle', 'triangle', 'diamond'],
    'size': [15, 25, 40],
    'category': ['a', 'b', 'c']
}

opts.defaults(opts.Points(size=8, line_color='black'))

hv.Points(data, kdims=['x values', 'y values'], vdims=["category"]).opts(marker="category")
image

Like color does:

import numpy as np
import holoviews as hv
from holoviews import dim, opts

hv.extension('bokeh')

data = {
    'x values': [0, 1, 0.5],
    'y values': [1, 0, 0.5],
    'alpha': [0.5, 1, 0.3],
    'color': ['red', 'blue', 'green'],
    'marker': ['circle', 'triangle', 'diamond'],
    'size': [15, 25, 40],
    'category': ['a', 'b', 'c']
}

opts.defaults(opts.Points(size=8, line_color='black'))

hv.Points(data, kdims=['x values', 'y values'], vdims=["category"]).opts(color="y_values")
image
@ahuang11 ahuang11 added the TRIAGE Needs triaging label Sep 19, 2024
@hoxbro
Copy link
Member

hoxbro commented Sep 20, 2024

Likely some custom logic is needed like what is done with colors here:

def _get_cmapper_opts(self, low, high, factors, colors):

Not sure how it should be done.

To get something working for your example you could do this hv.Points(data, kdims=["x values", "y values"], vdims=["category", "marker"]).opts(marker="marker"):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TRIAGE Needs triaging
Projects
None yet
Development

No branches or pull requests

2 participants