Re: [Matplotlib-users] timer objects in macosx backend

2013-07-18 Thread Michiel de Hoon
Hi Brendan, Justin,
Thanks for your reply. I agree then that a .stop() method is needed. This is 
not very difficult; I'll try and implement it over the weekend.
Best,
-Michiel.





 From: Brendan Barnwell 
To: matplotlib-users@lists.sourceforge.net 
Sent: Friday, July 19, 2013 3:54 AM
Subject: Re: [Matplotlib-users] timer objects in macosx backend
 

On 2013-07-18 06:56, Justin Lazear wrote:> Hi Michiel,
>
> On my system, deleting the timer has no effect and the timer continues
> to send events. The __del__ method seems to call the same unimplemented
> _timer_stop method. Regardless, something else has a reference to the
> timer (MPL event loop maybe?) and __del__ is not being called once the
> timer has been started. It's not clear to me what should be 
stopping the
> timer in that case.
>
> Does del t stop the timer on your system? If so, could we hunt down 
what
> is happening after you delete the name t that is causing the timer 
to stop?
>
> I would personally prefer an explicit .stop() method, since I would
> prefer not to rely on the garbage collector's behavior being consistent
> (hard to make sure nothing else is holding a reference to timer) when
> there is a very well-defined function that does what I want.

    Relying on "del t" can't be the right solution, since like you note, 
it only deletes the name, not the object.  If you create multiple 
references to a timer and only del some of them, e.g.:

t = fig.canvas.new_timer()
x = t
del t

Then the object's __del__ will definitely not be called yet.  It makes 
sense to have a way to stop the timer directly, regardless of how many 
names are pointing to it.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
    --author unknown

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] timer objects in macosx backend

2013-07-18 Thread Brendan Barnwell
On 2013-07-18 06:56, Justin Lazear wrote:> Hi Michiel,
 >
 > On my system, deleting the timer has no effect and the timer continues
 > to send events. The __del__ method seems to call the same unimplemented
 > _timer_stop method. Regardless, something else has a reference to the
 > timer (MPL event loop maybe?) and __del__ is not being called once the
 > timer has been started. It's not clear to me what should be 
stopping the
 > timer in that case.
 >
 > Does del t stop the timer on your system? If so, could we hunt down 
what
 > is happening after you delete the name t that is causing the timer 
to stop?
 >
 > I would personally prefer an explicit .stop() method, since I would
 > prefer not to rely on the garbage collector's behavior being consistent
 > (hard to make sure nothing else is holding a reference to timer) when
 > there is a very well-defined function that does what I want.

Relying on "del t" can't be the right solution, since like you note, 
it only deletes the name, not the object.  If you create multiple 
references to a timer and only del some of them, e.g.:

t = fig.canvas.new_timer()
x = t
del t

Then the object's __del__ will definitely not be called yet.  It makes 
sense to have a way to stop the timer directly, regardless of how many 
names are pointing to it.

-- 
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is 
no path, and leave a trail."
--author unknown

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] numpy masked array plot - isolated single unmasked value is hidden

2013-07-18 Thread Jody Klymak
Or make a stairstep, if each time has a finite duration.   like the following 
(though I am sure there are some inelegant code in there. 

data = np.arange(10)
mask = [0,0,0,1,1,0,1,0,0,0]
x = np.ma.masked_array(data, mask)
t = arange(-0.5,shape(x)[0]-0.5,1.)

xx=ma.zeros((2,10))
xx[0,:]=x
xx[1,:]=x
tt=0.*xx
tt[0,:]=t
tt[1,:]=t+0.999
tt=reshape(tt,(20),order='F')
xx=reshape(xx,(20),order='F')
plot(tt,xx)

On Jul 17, 2013, at  7:45 AM, Gregorio Bastardo  
wrote:

> Hi,
> 
> The following example demonstrates the problem, value 5 could not be
> seen w/o marker:
> 
> data = np.arange(10)
> mask = [0,0,0,1,1,0,1,0,0,0]
> x = np.ma.masked_array(data, mask)
> plot(x)
> plot(x, '+')
> 
> In my datasets, isolated unmasked values are rare, but placing a
> marker to spot them makes the whole graph cluttered. I do realize that
> at least 2 valid points are needed for a line segment, but still, is
> there any way to visualize these isolated unmasked values w/o a
> marker?
> 
> Thanks,
> Gregorio
> 
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Jody Klymak
http://web.uvic.ca/~jklymak/





--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] numpy masked array plot - isolated single unmasked value is hidden

2013-07-18 Thread Eric Firing
On 2013/07/17 11:25 PM, Gregorio Bastardo wrote:
> Thanks Mike, it's hard to spot, but still better than nothing. Anyway,
> could it be the default behaviour of plotting masked arrays (single
> pixel for an isolated element)?

Gregorio,

I don't think this would be a good idea.  It adds quite a bit of 
complexity for a special case--and inevitably, the next request from 
someone would be to have the option of using any marker for the isolated 
points.  The concept of "single pixel" gets slippery across backends and 
output devices.

A better solution would be a simple function to identify such isolated 
points, for use when needed, to plot such points however you choose, 
typically with a separate call to "plot" specifying a marker.  This way, 
the extra complexity is called explicitly when needed, not carried along 
by every call to "plot".

Eric

>
> 2013/7/17 Michael Droettboom :
>> You could use a single pixel for a marker (','), I guess.  But as you
>> say, you need at least two points for a line segment.
>>
>> Mike
>>
>> On 07/17/2013 10:45 AM, Gregorio Bastardo wrote:
>>> Hi,
>>>
>>> The following example demonstrates the problem, value 5 could not be
>>> seen w/o marker:
>>>
>>> data = np.arange(10)
>>> mask = [0,0,0,1,1,0,1,0,0,0]
>>> x = np.ma.masked_array(data, mask)
>>> plot(x)
>>> plot(x, '+')
>>>
>>> In my datasets, isolated unmasked values are rare, but placing a
>>> marker to spot them makes the whole graph cluttered. I do realize that
>>> at least 2 valid points are needed for a line segment, but still, is
>>> there any way to visualize these isolated unmasked values w/o a
>>> marker?
>>>
>>> Thanks,
>>> Gregorio


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Results of matplotlib user survey 2013

2013-07-18 Thread Michael Droettboom
Apologies: I didn't realize the link to the raw results only exists for 
users with edit permissions.  The public URL for the raw results is:


https://docs.google.com/spreadsheet/ccc?key=0AjrPjlTMRTwTdHpQS25pcTZIRWdqX0pNckNSU01sMHc&usp=sharing

Mike

On 07/18/2013 09:42 AM, Michael Droettboom wrote:
We have had 508 responses to the matplotlib user survey.  Quite a nice 
turnout!


You can view the results here:

https://docs.google.com/spreadsheet/viewanalytics?key=0AjrPjlTMRTwTdHpQS25pcTZIRWdqX0pNckNSU01sMHc&gridId=0#chart

and from there, you can access the complete raw results.

I will be doing more analysis of the results over the coming days and 
weeks, including dedup'ing some of the responses and converting some 
of the free-form responses into github issues etc.  Volunteers to help 
with this are of course welcome!


Cheers,
Mike


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] timer objects in macosx backend

2013-07-18 Thread Justin Lazear

Hi Michiel,

On my system, deleting the timer has no effect and the timer continues 
to send events. The __del__ method seems to call the same unimplemented 
_timer_stop method. Regardless, something else has a reference to the 
timer (MPL event loop maybe?) and __del__ is not being called once the 
timer has been started. It's not clear to me what should be stopping the 
timer in that case.


Does del t stop the timer on your system? If so, could we hunt down what 
is happening after you delete the name t that is causing the timer to stop?


I would personally prefer an explicit .stop() method, since I would 
prefer not to rely on the garbage collector's behavior being consistent 
(hard to make sure nothing else is holding a reference to timer) when 
there is a very well-defined function that does what I want.


Thanks,
Justin

On 7/18/13 12:54 AM, Michiel de Hoon wrote:

Hi Justin,

The .stop() method was indeed never implemented for Timer objects in 
the MacOSX backend.
I am not sure if a .stop() method is really needed, because deleting 
the timer has the same effect as stopping the timer.

Is there some reason you prefer
>>> t.stop()
instead of
>>> del t
?

Best,
-Michiel



*From:* Justin Lazear 
*To:* Matplotlib-users@lists.sourceforge.net
*Sent:* Thursday, July 18, 2013 12:13 AM
*Subject:* [Matplotlib-users] timer objects in macosx backend

Hi all,

I'm using a timer object to interact with the MPL event loop on my OS 
X laptop. However, it seems to be missing a few key methods that are 
making using it a little difficult. In particular, I can't find a way 
to stop the timer from sending events:


$ ipython --pylab

In [1]: def fun():
   ...: for i in range(5):
   ...: print "We're having fun!"; yield
   ...: for i in range(5):
   ...: print "Too much fun..."; yield
   ...: while True:
   ...: print "Stop the fun! No more!"; yield

In [2]: f = fun().next

In [3]: fig = plt.figure()

In [4]: t = fig.canvas.new_timer()

In [5]: t.add_callback(f)

In [6]: t.start()

In [7]: t.stop()

In [8]: del t  # It's all over now...


It looks like the stop method may never have been implemented:

In [3]: t.stop??
Type:   instancemethod
String Form:
File:
/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py
Definition: t.stop(self)
Source:
def stop(self):
'''
Stop the timer.
'''
self._timer_stop()

In [4]: t._timer_stop??
Type:   instancemethod
String Form:
File:
/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py
Definition: t._timer_stop(self)
Source:
def _timer_stop(self):
pass


I'm able to remove the callback function from the timer's callback 
list, but I suspect that won't stop the events from being triggered. 
But I'd really prefer to completely stop the timer events, since in my 
application I may end up going through many timers.


Is this the expected behavior? Is there an easy fix I'm overlooking?

Version info:

In [3]: sys.version
Out[3]: '2.7.3 (default, Feb 19 2013, 18:00:31) \n[GCC 4.2.1
Compatible Apple LLVM 4.2 (clang-425.0.24)]'

In [4]: mpl.__version__
Out[4]: '1.2.0'


Thanks,
Justin

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net 


https://lists.sourceforge.net/lists/listinfo/matplotlib-users




--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Results of matplotlib user survey 2013

2013-07-18 Thread Michael Droettboom
We have had 508 responses to the matplotlib user survey.  Quite a nice 
turnout!


You can view the results here:

https://docs.google.com/spreadsheet/viewanalytics?key=0AjrPjlTMRTwTdHpQS25pcTZIRWdqX0pNckNSU01sMHc&gridId=0#chart

and from there, you can access the complete raw results.

I will be doing more analysis of the results over the coming days and 
weeks, including dedup'ing some of the responses and converting some of 
the free-form responses into github issues etc.  Volunteers to help with 
this are of course welcome!


Cheers,
Mike
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes3d have improved handling of label placement yet

2013-07-18 Thread Benjamin Root
Jeffrey,

Sorry if the documentation is a bit vague on the _axinfo front.  It was
intentionally done that way to keep the number of people dependent upon
that kludge down.  It was created as an improvement upon the previous
hard-coded constants that completely prevented anybody from making any
customizations at all.

The spacing of tick labels for an axis can be modified like so:

ax.xaxis._axinfo['ticklabel']['space_factor'] = 0.7   # This is the default
value. Make it less to bring it closer to the axis

and for the axis label:

ax.xaxis._axinfo['label']['space_factor'] = 1.6  # Again, this is the
default value. Make it larger to move it away from the axis

I hope that helps!
Ben Root



On Thu, Jul 18, 2013 at 3:18 AM, Jeffrey Spencer wrote:

> I have a problem with labels overlapping the tickmark labels. No matter
> changing the fontsize or plot_size or other things. I can't find something
> that works properly. I found somethwhere setting linespacing should work
> but this seems to do nothing in my case.
>
> Any good suggestions or updates on this??
>
> I'm using 1.2.x matplotlib version. I put a plot here showing how the
> label overlaps but I know this has been a problem in the past.
>
> Also, I couldn't figure out how to get access to the _axinfo like stated
> in the documentation for a possible fix. Where is this located?? How do I
> acess or modify it as a temporary fix??
>
>
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Patch] Patch for fontmanager crash

2013-07-18 Thread Nicolas Mailhot
Le Mer 17 juillet 2013 15:04, Michael Droettboom a écrit :
> This patch doesn't make a whole lot of sense to me.  get_name should
> work just fine if self._family is None, and indeed it does in my own
> testing:
>
> ```
> from matplotlib import font_manager
>
> f = font_manager.FontProperties(None)
> print f._family
> print f.get_family()
> print f.get_name()
> ```
>
> So I'd much prefer to get to the bottom of the root cause of this
> problem than patch it unnecessarily in this way.  Any idea what that is?

I haven't the faintest idea. The function seems to be called with a "None"
font, and then it crashes. As it's executed under a Linux system it uses
the fontconfig backend with cairo. The call only occurs when matplotlib is
fed more data than can be isolated in an simple example

Attaching the only patches Fedora/Red Hat applied before the build :

Patch0: %{name}-noagg.patch
Patch1: %{name}-tk.patch
# http://sourceforge.net/mailarchive/message.php?msg_id=30202451
# https://github.com/matplotlib/matplotlib/pull/1666
# https://bugzilla.redhat.com/show_bug.cgi?id=896182
Patch2: %{name}-fontconfig.patch

[…]

# Remove bundled libraries
rm -r agg24 lib/matplotlib/pyparsing_py?.py

# Remove references to bundled libraries
%patch0 -p1 -b .noagg
sed -i -e s/matplotlib\.pyparsing_py./pyparsing/g lib/matplotlib/*.py

# Correct tcl/tk detection
%patch1 -p1 -b .tk
sed -i -e 's|@@libdir@@|%{_libdir}|' setupext.py

# Use fontconfig by default
%patch2 -p1 -b .fontconfig

Regards,

-- 
Nicolas Mailhot

python-matplotlib-fontconfig.patch
Description: Binary data


python-matplotlib-noagg.patch
Description: Binary data


python-matplotlib-tk.patch
Description: Binary data
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] numpy masked array plot - isolated single unmasked value is hidden

2013-07-18 Thread Gregorio Bastardo
Thanks Mike, it's hard to spot, but still better than nothing. Anyway,
could it be the default behaviour of plotting masked arrays (single
pixel for an isolated element)?

2013/7/17 Michael Droettboom :
> You could use a single pixel for a marker (','), I guess.  But as you
> say, you need at least two points for a line segment.
>
> Mike
>
> On 07/17/2013 10:45 AM, Gregorio Bastardo wrote:
>> Hi,
>>
>> The following example demonstrates the problem, value 5 could not be
>> seen w/o marker:
>>
>> data = np.arange(10)
>> mask = [0,0,0,1,1,0,1,0,0,0]
>> x = np.ma.masked_array(data, mask)
>> plot(x)
>> plot(x, '+')
>>
>> In my datasets, isolated unmasked values are rare, but placing a
>> marker to spot them makes the whole graph cluttered. I do realize that
>> at least 2 valid points are needed for a line segment, but still, is
>> there any way to visualize these isolated unmasked values w/o a
>> marker?
>>
>> Thanks,
>> Gregorio
>>
>> --
>> See everything from the browser to the database with AppDynamics
>> Get end-to-end visibility with application monitoring from AppDynamics
>> Isolate bottlenecks and diagnose root cause in seconds.
>> Start your free trial of AppDynamics Pro today!
>> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users