Given we want to make multiple scatter plots from a dataframe using a groupby
on a column like so:
perc_df.hvplot.scatter(
x="donor",
y="percentage",
c="sex",
rot=45,
width=1400,
groupby=["age_group"],
).layout(
"age_group"
).cols(
1
)
the coloration of the markers by the sex
column will performed independently on each of the groupby’d dataframes. For example, if your color cycle is [blue, orange], and by chance, a row with sex=='M'
happens to be first in the given dataframe for a subplot of the layout, it will be assigned blue, and vice versa for ‘F’. In my case, I’m pre-sorting the data for visualization by age
, so either sex category could randomly be the first row for a subplot. I was wondering if it was possible to enforce somehow that a particular category’s label should always be given a certain color.
Thanks!