Thank you very much. It works at last.

Kamel

2012/6/7 Tony Yu <tsy...@gmail.com>

>
> On Thu, Jun 7, 2012 at 12:14 PM, kamel maths <kamel.ma...@gmail.com>wrote:
>
>> Thanks for your answers.
>>
>> It is not very clear for me yet. This a script I tested.
>> ----------------------------------------------
>> from pylab import *
>>
>> fig = figure()
>> ax = fig.add_subplot(111)
>> ax.axis('equal')
>>
>> x = linspace(-2, 3, 50)
>> ax.plot(x, sin(x))
>>
>> ylim = ax.get_ylim()
>> print(ylim)
>>
>> show()
>>
>> ylim = ax.get_ylim()
>> print(ylim)
>> ------------------------------------
>> With the first print, I obtain (-1,1) and with the second one, after
>> having closed the figure showed, I obtain (-1.94,1.94). But I would like to
>> obtain (-1.94,1.94) with the first one in order to use this data in the
>> figure.
>> Is it possible ?
>>
>>
> Hi Kamel,
>
> (I'm recopying to the list; unfortunately, the mailing list doesn't do
> this automatically)
>
> Well, this is strange: I swear I tested this yesterday, and I got (-1.94,
> 1.94) when calling `get_ylim` before `show`. But when I test this today, I
> get (-1, 1) with the call before `show`.
>
> I guess the initial call to `get_ylim` returns that data limits (which are
> (-1, 1) in this case), but the call to  `axis('equal')` results in a
> rescaling at draw time.
>
> If you're just trying to readjust the plot before the plot blocks
> execution, you can run `draw()` right before calling `get_ylim`. There may
> be a better approach, though.
>
> -Tony
>
>
>
------------------------------------------------------------------------------
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