I am very excited about plotly-express, especially its simple user interface to draw multiple bar plot. However, in my own day-to-day analysis, I use the grouped bar plot a lot. I use it primary to compare different brands spending in several media channels, here is what I have in mind:
I wrote my own script group bar plot like this:
def group_bar_plot(dataframe, x, y, group, **kwargs):
items = dataframe[group].unique()
data = []
for item in items:
group_item = dataframe[dataframe[group]==item]
data.append(
go.Bar(
x = group_item[x],
y = group_item[y],
name = str(item)
)
)
layout = go.Layout(barmode='group')
layout.update(kwargs)
fig = go.Figure(data=data, layout=layout)
iplot(fig)
My questions is:
- Can I do the same thing use plotly-express?
- If not, how hard it is to write an additional feature like adding barmode=βgroupedβ into px.bar, in case I have some free time and I want to contribute.
Thanks in advance for any help.
Mike