Re: [Matplotlib-users] Is there an easy way to turn on automatic subticks?

2009-10-16 Thread Michael Waters
Ryan May wrote:
> On Fri, Oct 16, 2009 at 12:23 PM, Michael Waters  wrote:
>   
>> I am making regular Cartesian coordinate graphs with linear scales on
>> the axis. I would really like to have automatic subticks to make reading
>> data easier. Is there an easy way to do this?
>> 
>
> Yes, you just need to set a locator for the minor ticks, which is set
> to NullLocator by default.
>
> import matplotlib.pyplot as plt
> from matplotlib.ticker import MaxNLocator
> plt.plot([1,2,3])
> ax = plt.gca()
> ax.xaxis.set_minor_locator(MaxNLocator(nbins=30, steps=[1, 2, 5, 10]))
> plt.show()
>
> You might also want to look at:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/major_minor_demo1.html?highlight=codex%20minor
>
> Ryan
>
>   
That does it! Thanks a bunch.


-mike w.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Is there an easy way to turn on automatic subticks?

2009-10-16 Thread Ryan May
On Fri, Oct 16, 2009 at 12:23 PM, Michael Waters  wrote:
> I am making regular Cartesian coordinate graphs with linear scales on
> the axis. I would really like to have automatic subticks to make reading
> data easier. Is there an easy way to do this?

Yes, you just need to set a locator for the minor ticks, which is set
to NullLocator by default.

import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
plt.plot([1,2,3])
ax = plt.gca()
ax.xaxis.set_minor_locator(MaxNLocator(nbins=30, steps=[1, 2, 5, 10]))
plt.show()

You might also want to look at:

http://matplotlib.sourceforge.net/examples/pylab_examples/major_minor_demo1.html?highlight=codex%20minor

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Is there an easy way to turn on automatic subticks?

2009-10-16 Thread Michael Waters
I am making regular Cartesian coordinate graphs with linear scales on 
the axis. I would really like to have automatic subticks to make reading 
data easier. Is there an easy way to do this?

Thanks
-mike w.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users