I have been lately working with bokeh for plotting. I just found out about holoviews and wanted to plot a basic box plot.
In my box plot I am trying to color per one of the categories I am grouping the data in. Here is the code I am using:
hv.extension('bokeh')
%opts BoxWhisker (box_color='blue')
boxwhisker = hv.BoxWhisker(pool_ride_distance_time_year_less_hour, ['total_time', 'customer'], 'amount')
plot_opts = dict(show_legend=False, width=800, height=400)
I am trying to color it differently according to the customer variable (which is a yes/no dummy variable.) When I try to include a list in box_color it does not work. Also including an extra variable with color in the data set does not do the trick. Any ideas on how to make it work? Thanks!
Most Elements in HoloViews have a
color_index
plot option which allows coloring by a particular variable. Using your example here we color by the 'customer' variable and define a HoloViewsCycle
for the box_color using the Set1 colormap.If you want to define a custom set of colors you can also define an explicit Cycle like this:
Cycle(values=['#ffffff', ...])
.