But in order to use this, I have to know ymin and ymax, based on the
data. But I thought this was the point of the locators--that they
could assign the ticks based on the range of the data and then some
rule about placement of ticks in that range. But when I look at the
various kinds of locators in the docs, none have a parameter that is
equivalent to the 0.5 above in set_ticks.
Or do they and I just missed it?
···
On Wed, Jul 20, 2011 at 7:56 PM, Gökhan Sever <gokhansever@...287...> wrote:
On Wed, Jul 20, 2011 at 5:41 PM, C M <cmpython@...287...> wrote:
On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg >> <gbuchholz@...3595...> wrote:
>>-----Original Message-----
>>From: C M [mailto:cmpython@…287…]
>>
>>Sorry, this is super-simple, but I'm lost in the whole
>>locator/formatter part of the docs.
>>
>>How can I make a locator that just places a tick at every multiple of
>>0.5 around the data? So the y axis would look like:
>>
>>3.5 --
>>3.0 --
>>2.5 --
>>2.0 --
>>1.5 --
>>1.0 --
>
> Do you want something like:
>
> ylim(1.0,3.5)
> yticks(arrange(1.0,4.0,0.5))
I'm not sure, because I can't try it out--I'm using the OO matplotlib,
not Pyplot. What's the equivalent of this in the OO API?
But in order to use this, I have to know ymin and ymax, based on the
data. But I thought this was the point of the locators--that they
could assign the ticks based on the range of the data and then some
rule about placement of ticks in that range. But when I look at the
various kinds of locators in the docs, none have a parameter that is
equivalent to the 0.5 above in set_ticks.
Or do they and I just missed it?
Try MultipleLocator:
from matplotlib.ticker import MultipleLocator
halflocator = MultipleLocator(base=0.5)
ax.xaxis.set_major_locator(halflocator)
etc.
···
On 07/20/2011 03:17 PM, C M wrote:
On Wed, Jul 20, 2011 at 7:56 PM, Gökhan Sever<gokhansever@...287...> wrote:
On Wed, Jul 20, 2011 at 5:41 PM, C M<cmpython@...287...> wrote:
On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg >>> <gbuchholz@...3595...> wrote:
-----Original Message-----
------------------------------------------------------------------------------
5 Ways to Improve& Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more! http://www.accelacomm.com/jaw/sfnl/114/51426253/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net matplotlib-users List Signup and Options
from matplotlib.ticker import MultipleLocator
halflocator = MultipleLocator(base=0.5)
ax.xaxis.set_major_locator(halflocator)
etc.
Thanks, that works for me. I didn't think I could use non-integers
(0.5) because the docs said, "Set a tick on every integer that is
multiple of base in the view interval". Earlier in that page, though,
it does say base can be an integer or float.