Feature Request: Example of stacked horizontal bar chart from pandas groupby object.
Request for Example of stacked horizontal bar chart from pandas groupby object, preferably with red/green for good/bad values for each bar. Why? I can't get this to work in matplotlib 2.0, which seems to choke on this code
Is this a BUG REPORT or FEATURE REQUEST?:
Uncomment only one, leave it on its own line:
type: feature
Environment:
- Chartify version(s): n/a
- Operating System(s): Win 10
- Python version(s): 3.6.1
What happened: See https://stackoverflow.com/questions/53583715/trying-to-print-two-color-stacked-barh-using-matplotlib for details.
Note the issue seems to be creating the graph properly from a pandas groupby object.
Here is the unredacted code
if 'Incomplete Evidence' in df.Evaluation:
gb = df.groupby(group_by).Evaluation.value_counts(
).unstack(level=-1).nlargest(limit, columns='Incomplete Evidence').stack()
elif 'Complete Evidence' in df.Evaluation:
gb = df.groupby(group_by).Evaluation.value_counts(
).unstack(level=-1).nlargest(limit, columns='Complete Evidence').stack()
else:
gb = df.groupby(group_by).Evaluation.value_counts()
.# rbar = [x for x in gb.unstack(level=-1)['Incomplete Evidence']] .# gbar = [x for x in gb.unstack(level=-1)['Complete Evidence']]
. ### Temporarily using a bar chart
chart = gb.unstack(level=-1).plot.bar(color=chart_colors, stacked=True)
.# chart = plt.barh(0, rbar, color='r')
.# chart = plt.barh(1, gbar, left=rbar, color='g')
What you expected to happen:
A normal horizontal stacked bar with red/green from a groupby object.
How to reproduce it (as minimally and precisely as possible):
See code above - no way to create object in matplotlib to work as expected.
Anything else we need to know?: