>
>
>Richard Stanton <
sta...@haas.berkeley.edu>
> Oct 09 02:05PM -0700
>
>
>
>
>I have two different dataframes that I'd like to plot simultaneously
>(they share an x-axis).
>
>
>
>
>
>df1 I want to plot as a stacked bar chart, with labels for the different
>lines
>
>
>df2 I want to plot as a line chart on the same axes, but using a
>different y-scale.
>
>
>
>
>
>
>I can do either of these alone, but haven't been successful at getting
>them to plot simultaneously. Does anyone know how to do this?
>
>
>
>
>Thanks a lot.
>
>
>
>
>
>Richard Stanton
>
>
>
>
>
>Chang She <
ch...@lambdafoundry.com>
> Oct 09 05:08PM -0400
>
>
>
>
>
>
>> Thanks a lot.
>
>
>
>
>
>> Richard Stanton
>
>
>
>
>
>> --
>
>
>
>
>
>What do you get you when you try plotting them simultaneously? You're
>most likely running into this bug:
>
>
https://github.com/pydata/pandas/issues/1800
>
It certainly sounds relevant, but I don't necessarily get an error
message. For example, when I try
df1 = DataFrame({'Series1' : range(9)}, index = range(2000,2009))
df2 = DataFrame({'Series2' : 5}, index = range(2000,2009))
df1.plot(kind='bar')
df2.plot(secondary_y=True)
draw()
I get two plots, one after the other. The second (line) plot has an x
range of 0 - 2500, so the entire graph is really compressed!
If I make the index range(9), now the axes look better (still two separate
graphs, though), but even if they were on the same axes they wouldn't
quite work as the spacing of the x-axis labels is different. On the bar
chart, there's a gap between the left/right hand side of the box and the
leftmost/rightmost tick. On the line graph, there's no such gap.
Richard