How do you plan two pandas lines in the same ipython laptop cell to automatically use different colors?

When I run this in one cell, both lines of the graph are blue. I could swear I saw that Wes made a demo of children's names with two plots, where two plot lines came out in different colors, without indicating colors:

pd.Series(randn(100)).cumsum().plot() pd.Series(randn(100)).cumsum().plot() 

Yes, it was at 2:06:44 of this YouTube video: http://www.youtube.com/watch?v=w26x-z-BdWQ

+4
source share
2 answers

You just need to pass a couple of kwargs to the plot call

 import numpy as np import pandas as pd import matplotlib.pyplot fig, ax = plt.subplots() pd.DataFrame(np.random.randn(100, 2)).cumsum().plot(ax=ax) 
+3
source

I'm not sure how Wes did it in the video, but when using a graph (df.index, df.column) and does it several times with different columns, then the graphs have different colors.

(for this I use the plot command from ipython --pylab). )

+1
source

All Articles