leotac / joypy

Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:
MIT License
559 stars 59 forks source link

Adding an option to color the individual density plots #49

Closed yaront closed 4 years ago

yaront commented 4 years ago

Hi @sbebo, looks like there is no option to color the individual density plots in different axes (not subgroups). The colored_group flag enables coloring the individual density plots, only of there are no subgroups, based on the 'I' index instead of 'j' (which is always 0 if there are no subgroups, i.e. len(group) == 1):

if ((len(group) == 1) & (colored_groups)):
    element_color = _get_color(i, num_axes, i, num_subgroups)
else:
    element_color = _get_color(i, num_axes, j, num_subgroups)

Before: Figure_1

After: Figure_2

Also here I put the flag explicitly in the joyplot arguments, but is can be passed also as kwds. Thanks.