Re: [matplotlib-devel] Projections - custom_projection_example.py

2010-10-04 Thread Michael Droettboom
On 10/04/2010 02:10 AM, Mitchell Jon Stanton-Cook wrote:
> Hi Andrew,
>
> Thanks for the reply.
>
> I do not want to force users of my software to have to download and
> install basemap. It's just overkill for a small Python program that I'm
> developing.
>
> Perhaps I'm best to try and use a PathPatch for the  _gen_axes_patch
> _gen_axes_spines. Does anyone have any ideas?
>
Yes -- you would need to make a custom shape, and PathPatch or Polygon 
(if straight line segments are sufficient) are probably the way to go.

Mike
> Regards
>
> Mitch
>
>
>
> On 04/10/10 06:10, Andrew Straw wrote:
>
>> On 10/2/2010 8:33 PM, Mitchell Jon Stanton-Cook wrote:
>>
>>  
>>> Hello,
>>>
>>> I have been trying to modify the custom projection example
>>> (http://matplotlib.sourceforge.net/examples/api/custom_projection_example.html)
>>> to plot a Sanson Flamsteed Projection (Sinusoidal projection).
>>>
>>>
>> Dear Mitchell,
>>
>> Can you use the 'sinu' projection in basemap? E.g.
>> basemap/examples/contour_demo.py figure 1.
>>
>> -Andrew
>>
>>
>> --
>> Virtualization is moving to the mainstream and overtaking non-virtualized
>> environment for deploying applications. Does it make network security
>> easier or more difficult to achieve? Read this whitepaper to separate the
>> two and get a better understanding.
>> http://p.sf.net/sfu/hp-phase2-d2d
>> ___
>> Matplotlib-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>>
>>  
>
> --
> Virtualization is moving to the mainstream and overtaking non-virtualized
> environment for deploying applications. Does it make network security
> easier or more difficult to achieve? Read this whitepaper to separate the
> two and get a better understanding.
> http://p.sf.net/sfu/hp-phase2-d2d
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>


-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Event handling broken in svn?

2010-10-04 Thread Michael Droettboom
On 10/01/2010 02:01 PM, Fernando Perez wrote:
> Hey Ryan,
>
> On Fri, Oct 1, 2010 at 6:27 AM, Ryan May  wrote:
>
>> On Fri, Oct 1, 2010 at 1:05 AM, Fernando Perez  wrote:
>>  
>>> This manifested itself in some more complex MPL code that had multiple
>>> events not working when run inside ipython, but working OK outside of
>>> ipython.  Fortunately, the small self-contained example demonstrates
>>> the problem even with ipython not being in the picture at all (the
>>> runs above were from the command line), so I think there is an issue
>>> in MPL proper.
>>>
>>> Sorry that I can't dig deeper into the code right now to look for a fix...
>>>
>> Somewhere in the 1.0 development cycle, Michael modified the callback
>> code to take weak references to methods.  The purpose was to eliminate
>> some "leaks" that were occurring because callback connections to
>> objects were keeping them around and the proper disconnects were not
>> made (much simpler fix than tracking down every mpl_connect and trying
>> to see where do disconnect). What you're seeing in your script is that
>> since you're not assigning the Handler object to anything, it's being
>> garbage collected. It works for me if I change the second to last line
>> to:
>>
>> h = Handler(f)
>>  
> Many thanks for the info, that helps a lot.
>
> I was wondering though, would we still have a leak if strong
> references are held in the canvas attribute?  The canvas will be
> deleted when the figure goes away, so that should properly allow the
> callback references to be deleted, without deleting them early
> otherwise, no?
>
The problem is when callbacks create cyclical references (which your 
example does not).  If the Handler class in your example needed to 
update the figure or canvas in some way in the callback (which is a 
common usage pattern), that cyclical reference prevents either from 
being destroyed without running the cyclical garbage collector.  And in 
that case, you can't write a __del__ method on the handler to explicitly 
disconnect the callbacks.
> In any case, if my logic is flawed (quite likely, since I imagine M.
> D. had a good look at this), it might be worth adding a
>
> .. warning::
>
> section about this pattern to the event docs:
>
> http://matplotlib.sourceforge.net/users/event_handling.html
>
> because the problem is subtle and hard to diagnose (I just noticed it
> had also been reported recently
> http://sourceforge.net/mailarchive/forum.php?thread_name=4C9B7793.5020908%40gmail.com&forum_name=matplotlib-devel).
>
True -- it's non-obvious and confusing.  On the other hand, the user is 
no longer required to explicitly disconnect callbacks, which was the 
source of many other subtle and hard to diagnose problems within the 
matplotlib code itself.

I'm still not completely happy with it, so I'd love to find a "third 
way" if there's anything anyone can suggest.

Mike

-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Projections - custom_projection_example.py

2010-10-04 Thread Mitchell Jon Stanton-Cook
Hi Andrew,

Thanks for the reply.

I do not want to force users of my software to have to download and 
install basemap. It's just overkill for a small Python program that I'm 
developing.

Perhaps I'm best to try and use a PathPatch for the  _gen_axes_patch  
_gen_axes_spines. Does anyone have any ideas?

Regards

Mitch



On 04/10/10 06:10, Andrew Straw wrote:
>On 10/2/2010 8:33 PM, Mitchell Jon Stanton-Cook wrote:
>
>> Hello,
>>
>> I have been trying to modify the custom projection example
>> (http://matplotlib.sourceforge.net/examples/api/custom_projection_example.html)
>> to plot a Sanson Flamsteed Projection (Sinusoidal projection).
>>  
> Dear Mitchell,
>
> Can you use the 'sinu' projection in basemap? E.g.
> basemap/examples/contour_demo.py figure 1.
>
> -Andrew
>
>
> --
> Virtualization is moving to the mainstream and overtaking non-virtualized
> environment for deploying applications. Does it make network security
> easier or more difficult to achieve? Read this whitepaper to separate the
> two and get a better understanding.
> http://p.sf.net/sfu/hp-phase2-d2d
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>


--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Streamlines

2010-10-04 Thread 01d

Are developers of matplotlib planning to implement something like this:
http://www.pyngl.ucar.edu/Examples/Images/ngl04p.2.png ?
Thanks.
-- 
View this message in context: 
http://old.nabble.com/Streamlines-tp29867429p29867429.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.


--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Streamlines

2010-10-04 Thread Benjamin Root
On Sat, Oct 2, 2010 at 1:16 PM, 01d  wrote:

>
> Are developers of matplotlib planning to implement something like this:
> http://www.pyngl.ucar.edu/Examples/Images/ngl04p.2.png ?
> Thanks.
>

That would be a nice feature to add.  Would you like to file a feature
request on that?

http://sourceforge.net/tracker/?group_id=80706

Ben Root
--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] RuntimeError: Could not open facefile

2010-10-04 Thread DrDunk

Hi there,

I am a newcomer to this sort of thing, and inherited some Python code that
used matplotlib. I compiled the code as a windows executable, and sent it
out to my students..  Now, one of them is coming back to me with the error
you speak of.. (i.e. facefile problem with Vera.ttf)

Any hint on getting around this?

Maybe I need to give more info, however I am not sure what you might need..

Any help, gratefully accepted.



Benjamin Root-2 wrote:
> 
> Yes!  Thank you!
> 
> As extra debugging info, the issue was happening regardless of me choosing
> GTK, GTKAgg, and others for backends.
> 
> Ben Root
> 
> On Thu, Jun 3, 2010 at 2:45 PM, John Hunter  wrote:
> 
> 
>>
>> Just a shot in the dark, but does it help to flush the font cache in
>> your .matplotlib dir?
>>
>>  > rm -rf ~/.matplotlib/font*.cache
>>
>> JDH
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/RuntimeError%3A-Could-not-open-facefile-tp28772066p29879230.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.


--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Streamlines

2010-10-04 Thread Jason Grout

 On 10/04/2010 09:38 AM, Benjamin Root wrote:
On Sat, Oct 2, 2010 at 1:16 PM, 01d > wrote:



Are developers of matplotlib planning to implement something like
this:
http://www.pyngl.ucar.edu/Examples/Images/ngl04p.2.png ?
Thanks.


That would be a nice feature to add.  Would you like to file a feature 
request on that?


http://sourceforge.net/tracker/?group_id=80706


I would also love to have streamlines implemented.

Note that there is a scikit that does similar things using line 
convolution integrals:


http://www.scipy.org/scipy/scikits/#vectorplot

(not streamlines, but it creates a texture which gives you the idea of 
where streamlines are).


Jason
--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Streamlines

2010-10-04 Thread Jason Grout

 On 10/04/2010 09:38 AM, Benjamin Root wrote:
On Sat, Oct 2, 2010 at 1:16 PM, 01d > wrote:



Are developers of matplotlib planning to implement something like
this:
http://www.pyngl.ucar.edu/Examples/Images/ngl04p.2.png ?
Thanks.


That would be a nice feature to add.  Would you like to file a feature 
request on that?


http://sourceforge.net/tracker/?group_id=80706



Also, it seems like mathematica has a very nice streamline plot 
function, for comparison:


http://reference.wolfram.com/mathematica/ref/StreamPlot.html

Jason

--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Event handling broken in svn?

2010-10-04 Thread Fernando Perez
On Mon, Oct 4, 2010 at 6:13 AM, Michael Droettboom  wrote:
> The problem is when callbacks create cyclical references (which your
> example does not).  If the Handler class in your example needed to
> update the figure or canvas in some way in the callback (which is a
> common usage pattern), that cyclical reference prevents either from
> being destroyed without running the cyclical garbage collector.  And in
> that case, you can't write a __del__ method on the handler to explicitly
> disconnect the callbacks.
>> In any case, if my logic is flawed (quite likely, since I imagine M.
>> D. had a good look at this), it might be worth adding a
>>
>> .. warning::
>>
>> section about this pattern to the event docs:
>>
>> http://matplotlib.sourceforge.net/users/event_handling.html
>>
>> because the problem is subtle and hard to diagnose (I just noticed it
>> had also been reported recently
>> http://sourceforge.net/mailarchive/forum.php?thread_name=4C9B7793.5020908%40gmail.com&forum_name=matplotlib-devel).
>>
> True -- it's non-obvious and confusing.  On the other hand, the user is
> no longer required to explicitly disconnect callbacks, which was the
> source of many other subtle and hard to diagnose problems within the
> matplotlib code itself.
>
> I'm still not completely happy with it, so I'd love to find a "third
> way" if there's anything anyone can suggest.

Thanks for your explanation, it makes complete sense.

I think it's OK, Eric just added a warning to the docs, which will go
a long ways towards making this less of a user trap.  Given the
details you provided, I can't think of a generic way to handle these
cycles 100% automatically.  Using weakrefs seems like the most
sensible solution, and users will just need to understand a little bit
more before using this functionality.

Event handling isn't raw  beginner material in any case, so I don't
think it's a huge problem.  And if someone ever devises a clever
solution to the problem, then great!  But for now I think you can
safely ignore this further.

Regards,

f

--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel