change number of ticks matplotlib

I know many graduate students spend most of their time on plotting :)) And often you would have to change the frequency of xticks or yticks or their labels. Here is what I have to change the number of ticks.

Use two lines below to change the number of xticks or yticks in matplotlib in python.

start, end = ax.get_xlim()
ax.xaxis.set_ticks(np.arange(start, end, stepsize))

Advertisements

Author: Dasari

PhD Student in Stony Brook University

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s