Issue
I am making a stacked bar plot using:
DataFrame.plot(kind='bar',stacked=True)
I want to control width of bars so that the bars are connected to each other like a histogram.
I've looked through the documentation but to no avail - any suggestions? Is it possible to do it this way?
Solution
For anyone coming across this question:
Since pandas 0.14, plotting with bars has a 'width' command: https://github.com/pydata/pandas/pull/6644
The example above can now be solved simply by using
df.plot(kind='bar', stacked=True, width=1)
See pandas.DataFrame.plot.bar
or pandas.DataFrame.plot
with kind='bar'
.
When changing the width of the bars, it might also be appropriate to change the figure size by specifying the figsize=
parameter.
Answered By - Murkbeard
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.