Marc
March 10, 2020, 1:17pm
1
I have plot like the below generated from 3 plots something like the below.
plot_line = df_line.pivot(index="days_to_delivery", columns="year", values="value")
.hvplot(height=height, width=width)
.opts(invert_xaxis=True)
plot_dot = df_dot.pivot(index="days_to_delivery", columns="year", values="value").hvplot(height=height, width=width, size=100, kind="scatter")
.opts(invert_xaxis=True)
plot_dotted = df.dotted.hvplot(x="days_to_delivery", y="value", by=["year", "source"]).opts(
opts.Curve(line_dash="dotted")
plot = plot_line * plot_dot * plot_dotted *
Now I would like to programmatically deselect all series except the series 2020-2022. Similar to what I have done manually below.
How do I do that? . Any pointers to documentation or examples would be helpful. I’ve not been able to find it.
I would also like to control the colors. How do I do that? For example all 2021
series or dots should have the color green. How do I do that? Can I do it after I’ve created the overlay or should I do it before?
Marc
March 11, 2020, 10:47am
2
I’ve made some steps towards coloring each series.
color_cycle_line=hv.Cycle(
[
ORSTED_CLOUD_25,
ORSTED_SAND_LIGHT_50,
ORSTED_SAND_DARK_50,
ORSTED_CLOUD_50,
ORSTED_SAND_LIGHT_75,
ORSTED_SAND_DARK_75,
ORSTED_CLOUD_75,
ORSTED_SAND_LIGHT,
ORSTED_SAND_DARK,
ORSTED_CLOUD,
ORSTED_BLUE,
ORSTED_AQUA,
ORSTED_AUBERGINE,
ORSTED_CORAL,
ORSTED_SUN,
])
color_cycle_dot=hv.Cycle([ORSTED_BLUE, ORSTED_AQUA])
color_cycle_dotted=hv.Cycle([ORSTED_BLUE, ORSTED_AQUA, ORSTED_AUBERGINE])
plot_line=plot_line.options(({"Curve": {'color': color_cycle_line,}}))
plot_dot=plot_dot.options(({"Scatter": {'color': color_cycle_dot}}))
plot_dotted=plot_dotted.options(({"Curve": {'color': color_cycle_dotted}}))
plot = plot_line * plot_dot * plot_dotted
plot.options(bgcolor=ORSTED_TEXT_DIGITAL, background_fill_color=ORSTED_TEXT_DIGITAL, text_color=ORSTED_WHITE)
I cant seem to find any example of a dark background. As you can see its partly white.
How do I make the rest dark? I.e. set it to the color ORSTED_TEXT_DIGITAL.
Marc
March 11, 2020, 11:05am
3
It seems I need to create a Theme to set the outer background color
from bokeh.themes.theme import Theme
theme = Theme(
json={
'attrs' : {
'Figure' : {
'background_fill_color': ORSTED_TEXT_DIGITAL,
'border_fill_color': ORSTED_TEXT_DIGITAL,
'outline_line_color': '#444444',
},
'Grid': {
'grid_line_dash': [6, 4],
'grid_line_alpha': .3,
},
'Axis': {
'major_label_text_color': 'white',
'axis_label_text_color': 'white',
'major_tick_line_color': 'white',
'minor_tick_line_color': 'white',
'axis_line_color': "white"
}
}
})
hv.renderer('bokeh').theme = theme