I currently have a graph that looks like this using mathplotlib
However the margins between where the line actually starts and the edges of the graph are unnecessary, do you know how I can get rid of the margins so 0,0 starts at the corner?
For example, I want it to look like this
To show (0,0) on matplotlib graph at the bottom left corner, we can use xlim() and ylim() methods.
To change the range of X and Y axes, we can use xlim() and ylim() methods.
To fill the area under the curve, put x and y with ste="pre", using fill_between() method. Plot (x, y1) and (x, y2) lines using plot() method with drawstyle="steps" method. To display the figure, use show() method.
You can use the magic function %matplotlib inline to enable the inline plotting, where the plots/graphs will be displayed just below the cell where your plotting commands are written. It provides interactivity with the backend in the frontends like the jupyter notebook.
plt.xlim([0, x_max])
plt.ylim([0, y_max])
You can easily get the values of (x_max, y_max) from your data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With