I am encountering an issue with my Matplotlib graph where I'm seeing unexpected markings on the x and y axes. I've attached an image of the graph for reference. I'm unsure why this is happening and how to resolve it.
I'm using the following code to create the graph:
import matplotlib.pyplot as plt# Assuming df1 and other necessary variables are definedplt.figure(figsize=(13,7))fontsize = 15plt.title("Nonlinear Extrapolation of Revenues - Actual vs. Forecast", fontsize=fontsize)ax = plt.axes()# Setting the limits before plotting the dataplt.xlim(0, 18)plt.ylim(-500, 3000)Actual = np.array(df1.Actual1)Forecast = np.array(df1['Forecast Fit'])# Plotting the lines with different colorsplt.plot(Forecast, marker='o', color="green", label="Forecast")plt.plot(Actual, marker='o', color="blue", label="Actual")plt.legend(loc="center right")plt.show()
The graph is intended to display the comparison between actual and forecasted revenues. However, the x and y axes are showing additional markings, which I did not expect. I suspect there may be an issue with the data or how I'm setting the axis limits. Can anyone help me identify the problem and suggest a solution?