import matplotlib.pyplot as plt # Sample data: (x, y) x = [2000,2001,2002,2003,2004] y = [3200,2200,4700,1800,4600] # Create a figure and axes objects explicitly fig, ax = plt.subplots() # Plot data using the ax.plot() method ax.plot(x, y, marker='o') # Add labels and title ax.set_xlabel("Year") ax.set_ylabel("Earning") ax.set_title("Yearly Earnings (OO version using figure and subplots.)") # Display the plot plt.show()