I have been using the linked_brushing examples from here:
http://holoviews.org/user_guide/Linked_Brushing.html
In particular this one:
import datashader as ds
import holoviews.operation.datashader as hd
num = 100000
np.random.seed(1)
dists = {
cat: pd.DataFrame({
'x': np.random.normal(x, s, num),
'y': np.random.normal(y, s, num),
'val': np.random.normal(val, 1.5, num),
'cat': cat
}) for x, y, s, val, cat in
[( 2, 2, 0.03, 10, "d1"),
( 2, -2, 0.10, 20, "d2"),
( -2, -2, 0.50, 30, "d3"),
( -2, 2, 1.00, 40, "d4"),
( 0, 0, 3.00, 50, "d5")]
}
points = hv.Points(pd.concat(dists), ['x', 'y'], ['val', 'cat'])
datashaded = hd.datashade(points, aggregator=ds.count_cat('cat'))
spreaded = hd.dynspread(datashaded, threshold=0.50, how='over')
# Declare dim expression to color by cluster
dim_expr = ((0.1+hv.dim('val')/10).round()).categorize(hv.Cycle('Set1').values)
histogram = points.hist(num_bins=60, adjoin=False, normed=False).opts(color=dim_expr)
link_selections(spreaded + histogram)
In my use case I am trying to get text labels above the histogram bars, but searching through the documentation, I have not found a mechanism to do so.
In the example I have modified this line so I only get one bin per color:
histogram = points.hist(num_bins=4, adjoin=False, normed=False).opts(color=dim_expr)
And the output with a selection looks like this:
So I would like to understand how to have text labels above the bars that show the counts by color in the selection.
The goal is to show with the histogram the counts, but also to have a label that has an exact count in a text representation or label.