On 07/20/2011 03:17 PM, C M wrote:
> On Wed, Jul 20, 2011 at 7:56 PM, Gökhan Sever<gokhanse...@gmail.com>  wrote:
>>
>>
>> On Wed, Jul 20, 2011 at 5:41 PM, C M<cmpyt...@gmail.com>  wrote:
>>>
>>> On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg
>>> <gbuchh...@infiniacorp.com>  wrote:
>>>>> -----Original Message-----
>>>>> From: C M [mailto:cmpyt...@gmail.com]
>>>>>
>>>>> 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?
>>
>>
>>      ax.axis((xmin, xmax, ymin, ymax))
>>      ax.yaxis.set_ticks(np.arange(1.0, 4.0, 0.5))
>
> Thanks.
>
> 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.

>
> ------------------------------------------------------------------------------
> 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
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users



------------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to