Is there a way to change the color for CrosshairTool in Bokeh?
From another related question I borrowed this example code:
import numpy as np
from bokeh.plotting import figure, show
from bokeh.layouts import gridplot
from bokeh.models import CrosshairTool
plots = [figure() for i in range(6)]
[plot.line(np.arange(10), np.random.random(10)) for plot in plots]
linked_crosshair = CrosshairTool(dimensions="both")
for plot in plots:
plot.add_tools(linked_crosshair)
show(gridplot(children=[plot for plot in plots], ncols=3))
As per the documentation: http://docs.bokeh.org/en/latest/docs/reference/models/tools.html#crosshairtool
Set the public attributes line_color
and line_alpha
to modify the stroke path.
line_alpha = 1.0
An alpha value to use to stroke paths with.
Acceptable values are floating-point numbers between 0 and 1 (0 being transparent and 1 being opaque).
line_color = 'black'
A color to use to stroke paths with.Acceptable values are:
- any of the named CSS colors, e.g 'green', 'indigo'
- RGB(A) hex strings, e.g., '#FF0000', '#44444444'
- CSS4 color strings, e.g., 'rgba(255, 0, 127, 0.6)', 'rgb(0 127 0 /1.0)', or 'hsl(60deg 100% 50% / 1.0)'
- a 3-tuple of integers (r, g, b) between 0 and 255
- a 4-tuple of (r, g, b, a) where r, g, b are integers between 0 and 255, and a is between 0 and 1
- a 32-bit unsigned integer using the 0xRRGGBBAA byte order pattern
You can set line_width
to set the stroke width in pixels. (Default 1)
The documentation isn't explicit, but it should also be possible to set these properties as a theme using the apply_theme(property_values: Dict[str, Any])
method