In pandas I can set the date as index, and then run df.plot() to see a line chart. How do I make that line chart stacked as in the picture below?
$\begingroup$
$\endgroup$
1
-
$\begingroup$ Add your sample df $\endgroup$Aditya– Aditya2018-04-18 12:49:56 +00:00Commented Apr 18, 2018 at 12:49
Add a comment
|
1 Answer
3
-
$\begingroup$ Np. The keyword you may have left out was “area”, but honestly I’m not sure how I remembered that’s what these plots are called. $\endgroup$kbrose– kbrose2018-04-18 13:51:39 +00:00Commented Apr 18, 2018 at 13:51
-
$\begingroup$ Do you know how I would do if I would add a group D to that plot from python-graph-gallery, and group D should not be stacked i.e. just a regular line? $\endgroup$jacob– jacob2018-04-18 14:00:54 +00:00Commented Apr 18, 2018 at 14:00
-
$\begingroup$ df.plot.area() returns the matplotlib axis object, just call ax.plot(my_data) $\endgroup$kbrose– kbrose2018-04-18 15:46:26 +00:00Commented Apr 18, 2018 at 15:46
