How do I set grid spacing?

I create my figure in my (non-interactive) script like so:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(...)

Then I want to set the spacing of y grid to 50 units (axis units). Do I need a method of the matplotlib.axis.Axis, or matplotlib.axes.Axes (or are these the same??), or something else?

Ben.

Ben
Does "ax.set_xlim([0,50])" do what you want it to do?

-paul

···

On Tue, Apr 3, 2012 at 5:57 PM, Ben Harrison <ben.harrison@...4029...> wrote:

I create my figure in my (non-interactive) script like so:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(...)

Then I want to set the spacing of y grid to 50 units (axis units). Do I
need a method of the matplotlib.axis.Axis, or matplotlib.axes.Axes (or
are these the same??), or something else?

Ben.

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

hi paul,

i finally worked it out, and should have replied to myself:

ax.set_xticks(np.arange(0,100,20))

for me it seemed to work.

ben.

···

On 11/04/12 07:34, Paul Hobson wrote:

Ben
Does "ax.set_xlim([0,50])" do what you want it to do?

-paul