Home > Software design >  How do you add two df to a plot map?
How do you add two df to a plot map?

Time:09-29

I want to combine df1.plot() and df0.plot() onto one plot graph. Currently, when running both, it will give me two plot maps, and I'm out of my expertise on how to join both of them.

import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = [25, 10]
df = df.sort_values('datetime', ascending=True)
df1.plot()
df0.plot()
plt.show()

Plot images

CodePudding user response:

Replace your code

df1.plot()
df0.plot()

The following code will help:

plt.plot(df1["X"], df1["Y"])
plt.plot(df0["X"], df0["Y"])
plt.show()

CodePudding user response:

You can either entirely switch over to Matplotlib code as enter image description here

  • Related