Specifying the number of ticks on y-axis

Hi,
Is there a way to specify the number of ticks on an axis? Say, I want the y-axes on all my subplots to have 5 ticks, for example.

Thanks.
Sharaf

Sharaf Al-Sharif wrote:

Hi,
Is there a way to specify the number of ticks on an axis? Say, I want the y-axes on all my subplots to have 5 ticks, for example.

import matplotlib.ticker as mticker
ax.yaxis.set_major_locator(mticker.MaxNLocator(4,steps=[1, 2, 5, 10]))