Description
I take an example from
https://stackoverflow.com/questions/23951230/python-axis-limit-in-matplotlib
In mplot3d, when you set, for example, set_xlim(0, 0.8)
, the outcome has an extra like set_xlim(0 - eps, 0.8 + eps)
, where eps is related to deltas
.
matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py
Line 187 in 6e76411
To show the exact lims, you have to change deltas
to, for example, 0 * (maxs - mins) / 12.
You need something to set exact lims without touching the inside of matplotlib.
Code for reproduction
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection = '3d')
ax.set_xlim(0,0.8)
plt.show()
Matplotlib version
- Operating system:macOS 10.14.6
- Matplotlib version: 3.1.1
- Python version: 3.7.4
The problem was discussed many times in STACK OVERFLOW:
https://stackoverflow.com/questions/23951230/python-axis-limit-in-matplotlib
https://stackoverflow.com/questions/46380464/matplotlib-3d-axis-bounds-always-too-large-doesnt-set-lims-correctly
https://stackoverflow.com/questions/16488182/removing-axes-margins-in-3d-plot