I do a lot of graphing in Matplotlib, where external data points lie on the edge of the plot space, which often hides important data. For example, I would like to do something like:
f, ax = subplots(1, 1) ax.plot([0, 1], [.25, .5], "o")
As written, Iβm ending up with a plot where xaxis goes from 0 to 1, and itβs really difficult to get an idea of ββhow the data looks (plus it spends a lot of space).
I would like to somehow limit the reset of the limits of the x axis so that a) it adds space on each side and b) xticks span the entire xaxis with reasonable (default) intervals. Obviously, in one case, I could use ax.set_xlim () and ax.set_xticks (), but I generate a lot of these graphs and I donβt know in advance which optimal way to adjust the graphs would be.
Is there any option in Matplotlib to set the percentage of the x data range that spans the x axis or similar?
source share