The following code generates the linked image. It generates mostly what I want but I would like the box color to be different between Real and Preds. How would I do that with Holoviews or Hvplot?
import hvplot.pandas
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(20), columns=['Value'])
df['Source'] = ['Preds'] *10 +['Real'] * 10
df['Item'] = ['item1'] *5 + ['item2']*5 + ['item1'] *5 + ['item2']*5
df.hvplot.box(y='Value', by=['Item', 'Source'])
I would like the first graph of this image to be in the style of the second
You can do it by setting the color and cmap parameter:
df.hvplot.box(
y='Value',
by=['Item', 'Source'],
color='Source',
cmap=['blue', 'orange'],
legend=False,
)
Or by setting .opts(box_color):
df.hvplot.box(
y='Value',
by=['Item', 'Source'],
legend=False,
).opts(
box_color='Source',
cmap='Category20',
)
See also this SO question:
Holoviews color per category
More info on choosing particular colors for plots:
http://holoviews.org/user_guide/Styling_Plots.html
http://holoviews.org/user_guide/Colormaps.html