Closed
Description
Bug summary
The MaxNLocator
with the prune
parameter does not work as documented.
I read:
prune: {'lower', 'upper', 'both', None}, default: None
Remove edge ticks -- useful for stacked or ganged plots where the upper tick of one axes overlaps with the lower tick of the axes above it, primarily when rcParams["axes.autolimit_mode"] (default: 'data') is 'round_numbers'. If prune=='lower', the smallest tick will be removed. If prune == 'upper', the largest tick will be removed. If prune == 'both', the largest and smallest ticks will be removed. If prune is None, no ticks will be removed.
However, no tick is removed when I set prune
to "lower", "upper" or "both".
Code for reproduction
from matplotlib import pyplot as plt
from matplotlib import ticker as mtick
fig, ax = plt.subplots()
ax.plot(range(4), range(4))
ax.xaxis.set_major_locator(mtick.MaxNLocator(4, prune="both"))
Actual outcome
Expected outcome
Additional information
No response
Operating system
Ubuntu
Matplotlib Version
3.8.0
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.12.0
Jupyter version
4.0.7
Installation
conda