How can I get rid of the white space in matplotlib? I am doing a course in edx. While plotting in python, there is always a blank space before the beginning of the plot. In StackExchange, I have found a solution, which is mentioning the axis limit. However, in maximum cases, the starting points of the plot is unknown. So, Is there any solution to this without manipulating the axis limits manually? A graph is attached herewith for making things more clear.
This stackoverflow answer should solve your issue. You can use either plt.margins(x=0) or ax.margins(x=0) to remove all margins on the x-axis.