Here is this code:
import matplotlib.pyplot as plt
import numpy as np
from numpy.core.function_base import linspace
import pandas as pd
data = {'col1' : linspace(1,3),
'col2' : linspace(3, 6)
}
df = pd.DataFrame(data)
fig = plt.figure()
axes = df['col1'].plot()
plt.show()
How can I set 'col2' of the data frame to be the X-axis using the object-oriented approach, please?
Bonus: How to use two X-axis? 'col2' would be the X-axis displayed at the bottom of the plot, 'col3' would be the X-axis marked at the top of the plot? Again, using the object-oriented approach.