How do I set the line color of a Whisker in a Bokeh Theme?

Hi there. I am trying to improve the built in Bokeh Theme for the Panel Dark Themed Fast Theme in Issue #4313 · holoviz/panel (github.com).

I can see that using the Bokeh Whisker model and the argument line_color I can set the color of the Whisker

Whisker(source=source_error, base="base", upper="upper", lower="lower", line_color="yellow")

But I don’t know how to the add this to a Bokeh Theme json specification like the below.

{
'attrs' : {
    'Plot': {
        'background_fill_color': '#2F2F2F',
        'border_fill_color': '#2F2F2F',
        'outline_line_color': '#444444',
    },
    'Axis': {
        'axis_line_color': null,
    },
    'Grid': {
        'grid_line_dash': [6, 4]',
        'grid_line_alpha': .3,
    },
    'Title': {
        'text_color': 'white'
    }
}

How do I do that? Thanks.

Not ideal, but like this:

Theme(json={
    "attrs": {
        "Whisker": {
            "line_color": "yellow",
        },
        "ArrowHead": {
            "line_color": "yellow",
        },
    },
})

Or more explicitly using {"value": "yellow"}, as we are dealing with vectorized properties.

Ideally something like this would work:

Theme(json={
    "attrs": {
        "Whisker": {
            "line_color": "yellow",
            "upper_head": {
                "line_color": "yellow",
            },
            "lower_head": {
                "line_color": "yellow",
            },
        },
    },
})

This works though:

from bokeh.models import TeeHead
Theme(json={
    "attrs": {
        "Whisker": {
            "line_color": {"value": "red"},
            "upper_head": TeeHead(size=10, line_color="red"),
            "lower_head": TeeHead(size=10, line_color="red"),
        },
    },
})

but I think you can’t replicate this in a yaml-based theme.

1 Like

That’s honestly surprising (pleasantly, I guess?) but perhaps we ought to raise the possibility of deprecating and discouraging the yaml format for themes if it can’t have full parity.

1 Like