python - Plot line charts on same axis -
i want plot line plots on same chart same axis. instead several plots. how overlay each plot, x axis time , y wap? have spent several days on , asked question several times...if knows answer...pls share.
grouped = df2.groupby('date') print(grouped) grouped.plot(x='time', y='wap', kind='line') plt.show()
to plot 2 dataframes
on 1 figure, can following:
import random import pandas pd import matplotlib.pyplot plt # create y vals, here we'll create 10 between 1 , 100 (exclusive) y1 = random.sample(range(1, 100), 10) y2 = random.sample(range(1, 100), 10) # create dataframes of y vals df1 = pd.dataframe(data={'yvals1': y1}) df2 = pd.dataframe(data={'yvals2': y2}) # create matplotlib.axes object df2 can share df1's axis df1_ax = df1.plot() df2.plot(ax=df1_ax) plt.show()
Comments
Post a Comment