Closed as not planned
Description
Bug summary
Sometimes, the axis tick labels overlaps. In such cases, manually adjusting their positions slightly is one solution. However, I found that this doesn't seem to work.
Here is a simple example. I simulated a situation where the text would overlap by setting a smaller figure size.
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(0.2, 0.2))
ax = fig.subplots(1, 1)
ax.plot(range(10), range(10))
plt.show()
As it can be seen, the y-axis labels '0' and '5' have some overlap.
Then, I obtained the y-axis tick label objects using get_yticklabels
and tried to raise the position of '5' using set_position
. As shown below, nothing changed.
Code for reproduction
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(0.2, 0.2))
ax = fig.subplots(1, 1)
ax.plot(range(10), range(10))
texts = ax.get_yticklabels()
for text in texts:
if text.get_text() == "5":
text.set_position((0, 6))
plt.show()
Actual outcome
Expected outcome
The position of '5' on the y-axis should be adjusted upwards.
Additional information
No response
Operating system
Debian
Matplotlib Version
3.10.1
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.13.2
Jupyter version
4.4.0
Installation
pip