On Wed, Jun 6, 2012 at 6:12 PM, Tony Yu <tsy...@gmail.com> wrote:

>
>
> On Wed, Jun 6, 2012 at 3:32 PM, kamel maths <kamel.ma...@gmail.com> wrote:
>
>> Hi,
>>
>> for this script:
>> ------------------------------------
>> from pylab import *
>>
>> fig = figure()
>> ax = fig.add_subplot(111)
>> ax.axis('equal')
>>
>> x = linspace(-2, 3, 50)
>> ax.plot(x, sin(x))
>>
>> show()
>> ---------------------------------
>> If I try to get ymax with ax.get_ylim(), i obtain 1.0 whereas I observe
>> it is 2.0.
>> How can I obtain 2.0 for ymax ?
>>
>> Thanks.
>>
>> Kamel
>>
>
> Hi Kamel,
>
> I'm not seeing the same result: I actually get back (-1.94, 1.94) from
> `get_ylim`. When do you call `get_ylim`? Do you call it *after* calling
> `plot`?
>
> -Tony
>
>
Or, more likely, are you calling it *after* you close the figure?  If so,
then the axes has already been cleared and you are merely finding the
limits for a newly created (but unshown) figure.

Make sure you get the limits after the plotting, but before the show().

Ben Root
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to