I am following some online code to add major yticks to a bar chart. However, I'm finding that the major yticks and the ylim changes for no reason, even though I don't add new major yticks: import pandas as pd import matplotlib.pyplot as plt plt.close('all') ax = pd.Series([600,1e3,1e4],index=['A','B','C']).plot.bar() plt.yscale('log') # This causes ylim and major yticks to change if False: ax.set_yticks( ax.get_yticks(minor=False) ) I am using: Spyder version: 6.0.5 (conda) Python version: 3.9.18 64-bit Qt version: 5.15.2 PyQt5 version: 5.15.10 Operating System: Windows-10-10.0.26100-SP0 Afternote 2025-06-16 15:28 ET: I found that I can force the yticks and ylim back by saving ylim (ylim=plt.ylim()) before calling set_yticks, then restoring it afterward (plt.ylim(ylim)), but why is this necessary at all? In other words, why does calling set_yticks run different heuristics for determining ylim and yticks? Continue reading...