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() 

plot day1 plot day2

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() 

this outputs like: example output


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -