I want a plot with two y-axes from two different data frame in one plot.
So far I tried to change the one data frame two y-axes version but I failed.
import pandas as pd
import matplotlib.pyplot as plt
plt.close("all")
df1 = pd.DataFrame({"x1": [1,2 ,3 ,4 ],
"y1_1": [555,525,532,585],
"y1_2": [50,48,49,51]})
df2 = pd.DataFrame({"x2": [1, 2, 3,4],
"y2_1": [557,522,575,590],
"y2_2": [47,49,50,53]})
ax1 = df1.plot(x="x1", y="y1_1", legend=False)
ax2 = ax1.twinx()
df1.plot(x="x1", y="y1_2", ax=ax2, legend=False, color="r")
ax3 = df2.plot(x="x2", y="y2_1", legend=False)
ax4 = ax1.twinx()
df2.plot(x="x2", y="y2_2", ax=ax4, legend=False, color="r")
plt.grid(True)
ax1.figure.legend()
plt.show()
below this is what I want.
So far I have two plots but I want just everything in one plot.
