In the bokeh Holoviews gallery, there is an example called 'Scatter economic'.
http://holoviews.org/gallery/demos/bokeh/scatter_economic.html#bokeh-gallery-scatter-economic
In this plot, notice how one of the options for Scatter
is (color=Cycle('Category20')
). The last line of the plot is gdp_unem_scatter.overlay('Country')
.
Scatter
to a particular color in Cycle('Category20')
? Is this just a property of Cycle()
? Is there some way that the Overlay
interacts with the Scatter and with the Cycle automatically? .opts
method with this cycle color on the Scatter
(i.e., second to the last line in the above example), and then do an .overlay('Country')
, somehow Holoviews knows to assign each Scatter to a particular color based on the Country. I want to make sure that I am properly plotting what I intend to.
Thank you!
It is now possible to map categories in an NdOverlay (as is used in the example above) by using a so called dim expression and then define an expression to do the mapping:
dim_expr = hv.dim('category').categorize({'A': 'red', 'B': 'green', 'C': 'blue'})
overlay = hv.NdOverlay({chr(65+i): hv.Scatter(np.random.rand(10, 2)) for i in range(3)}, 'category')
overlay.opts(hv.opts.Scatter(color=dim_expr))
In this example we created a dim
expression which points to the 'category' dimension and then maps each category ('A', 'B' and 'C') to a color ('red', 'green', 'blue'). We then just assign that to the color option.