Re: [Matplotlib-users] Legend Marker Color Bug

2012-09-05 Thread Sterling Smith
On Sep 4, 2012, at 5:33PM, Jae-Joon Lee wrote:

 On Wed, Sep 5, 2012 at 6:05 AM, Sterling Smith smit...@fusion.gat.com wrote:
 I still do not get black markers.  Furthermore, if you try to make a new 
 legend with the result of leg.get_lines(), you will get lines without 
 markers, which leads me to the conclusion I stated in my previous email 
 (which you did not copy)
 I suspect that this is because the legend marker is drawn separately from 
 the legend line to accommodate the numpoints argument of the legend 
 functions.  Then the question is how to access these markers if they are 
 separate from the line2d objects in the legend.  I didn't even see them in 
 the children of the legend [legend.get_children()].
 
 This is correct. To support legend handle like --o-- (i.e., no markers
 at the ends), lines and markers are drawn as a separate artist. You
 may use something like,
 
 line[0]._legmarker.set_markerfacecolor('black')
 line[1]._legmarker.set_markerfacecolor('black')
 
 I, personally, recommend you to use a proxy artist.
 
 http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
 
 For example,
 
 You may do something like
 
 import pylab
 pylab.plot(pylab.linspace(0,1,100),marker='o',ls='')
 pylab.plot(pylab.linspace(0,1,100),marker='o',ls='-')
 
 # creates artists for legend purpose only
 l1, = pylab.plot(pylab.linspace(0,1,100), 'ko-')
 l2, = pylab.plot(pylab.linspace(0,1,100), 'ko')
 # remove them from the axes.
 l1.remove()
 l2.remove()
 
 leg=pylab.legend([l1, l2], [Test 1, Test 2], loc='best')
 
 Regards,
 
 -JJ

JJ,

Thank you for responding.  I was looking for the _legmarker method, which works 
great.

Thanks,
Sterling


--
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


[Matplotlib-users] Using the lasso tool when file is not main

2012-09-05 Thread Mark Budde
Hi,
I'm not an expert so please go easy on me. I am using the pyplot lasso
demo, and have got it to work how I would like. I am having a problem,
however, where I cannot get it to work if my python file is not the
main file (where __name__ is not __main__).

I took the part at the bottom in the if __name__ == '__main__': and
put it into a class. Everything works fine if I call the class from
within the same file. However, if I call the class from another file,
the graph loads fine but the lasso tool does not work. Troubleshooting
revealed that LassoManager.onpress is not being called when I click
the mouse. Any suggestions are welcome because this is driving me
crazy!
Thanks,
Mark

--
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


Re: [Matplotlib-users] Using the lasso tool when file is not main

2012-09-05 Thread Benjamin Root
On Wednesday, September 5, 2012, Mark Budde wrote:

 Hi,
 I'm not an expert so please go easy on me. I am using the pyplot lasso
 demo, and have got it to work how I would like. I am having a problem,
 however, where I cannot get it to work if my python file is not the
 main file (where __name__ is not __main__).

 I took the part at the bottom in the if __name__ == '__main__': and
 put it into a class. Everything works fine if I call the class from
 within the same file. However, if I call the class from another file,
 the graph loads fine but the lasso tool does not work. Troubleshooting
 revealed that LassoManager.onpress is not being called when I click
 the mouse. Any suggestions are welcome because this is driving me
 crazy!
 Thanks,
 Mark


I can assure you that it does work from a library because I have done that.
 Most likely it is some minor error in your code.  Is it possible to post a
simple example to demonstrate your problem?

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


Re: [Matplotlib-users] Using the lasso tool when file is not main

2012-09-05 Thread Tony Yu
On Wed, Sep 5, 2012 at 7:19 PM, Mark Budde markbu...@gmail.com wrote:

 Hi,
 I'm not an expert so please go easy on me. I am using the pyplot lasso
 demo, and have got it to work how I would like. I am having a problem,
 however, where I cannot get it to work if my python file is not the
 main file (where __name__ is not __main__).

 I took the part at the bottom in the if __name__ == '__main__': and
 put it into a class. Everything works fine if I call the class from
 within the same file. However, if I call the class from another file,
 the graph loads fine but the lasso tool does not work. Troubleshooting
 revealed that LassoManager.onpress is not being called when I click
 the mouse. Any suggestions are welcome because this is driving me
 crazy!
 Thanks,
 Mark


Hi Mark,

I can't seem to reproduce your issue, but it's a bit difficult without
seeing how exactly you wrapped up the main part of the code. Just
guessing: maybe the two cases aren't *exactly* the same.

Is it possible that you have ``lman`` (the LassoManager instance) defined
in the same block of code as ``show`` in one case but not the other? If,
for example, ``lman`` is defined in a method of your class, but not saved
anywhere then it'll get discarded after the method finishes. So ``show``
would need to be called inside that method, or saved as a class attribute.

Like I said, that's just a wild guess. You should paste the class def if
you're still having problems.

Best
-Tony

P.S. If you're running matplotlib from Github master, you might be
interested in an alternative lasso tool  (LassoSelector) that may be
simpler to use.:
https://github.com/matplotlib/matplotlib/blob/master/examples/widgets/lasso_selector_demo.py
--
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


Re: [Matplotlib-users] type error with python 3.2 and version 1.1.1 of matplotlib (numpy error)

2012-09-05 Thread Paul Tremblay
I am using numpy 1.7, which I built myself (python3 setup.py build). I had
a chance to look a bit deeper into matplotlib, which in turn forced me to
learn a bit of numpy, and now I see that it probably makes more sense to
use numpy arrays for my data. Since the default for an array is a float,
most users won't encounter the problems I did, but a warning in a FAQ might
solve a few headaches, regardless of how the developers decided to go.

Thanks for your help.

Paul

On Tue, Sep 4, 2012 at 3:09 PM, Benjamin Root ben.r...@ou.edu wrote:



 On Tue, Sep 4, 2012 at 2:20 PM, Paul Tremblay paulhtremb...@gmail.comwrote:


 The following Python code:

 ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)

 Produces this error with Python 3.2:

 Traceback (most recent call last):
   File scripts/audit_reports_weekly.py, line 150, in module
 ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
   File
 /home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/matplotlib/axes.py,
 line 6741, in fill_between
 y1 = ma.masked_invalid(self.convert_yunits(y1))
   File
 /home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/numpy/ma/core.py,
 line 2241, in masked_invalid
 condition = ~(np.isfinite(a))
 TypeError: ufunc 'isfinite' not supported for the input types, and the
 inputs could not be safely coerced to any supported types according to the
 casting rule ''safe''


 [Decimal('3619.900530366609820157812617'), .]

 If I change the list from type Decimal to type float, then I don't get
 the error. Likewise, if I use Python 2.7, I also don't get an error.

 After reading over the error message, I realize that this error really
 results because of numpy, not matplotlib. But I'll go ahead and post this
 message, in case you are unaware of the problem.


 Just a quick note, mpl v1.1.x is not officially supported for py3k.  The
 upcoming release of v1.2.0 will be the first official release with such
 support.

 That being said, it probably would be a good idea to make sure where the
 bug lies for this one (numpy or matplotlib).  Which version of numpy are
 you using?

 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


Re: [Matplotlib-users] type error with python 3.2 and version 1.1.1 of matplotlib (numpy error)

2012-09-05 Thread Eric Firing
On 2012/09/05 4:04 PM, Paul Tremblay wrote:
 I am using numpy 1.7, which I built myself (python3 setup.py build). I
 had a chance to look a bit deeper into matplotlib, which in turn forced
 me to learn a bit of numpy, and now I see that it probably makes more
 sense to use numpy arrays for my data. Since the default for an array is
 a float, most users won't encounter the problems I did, but a warning in
 a FAQ might solve a few headaches, regardless of how the developers
 decided to go.

Paul,

numpy 1.7 has a new datetime dtype which probably would be good for your 
use--except that mpl doesn't support it yet.  That will be a project for 
mpl v1.3.

Eric


 Thanks for your help.

 Paul

 On Tue, Sep 4, 2012 at 3:09 PM, Benjamin Root ben.r...@ou.edu
 mailto:ben.r...@ou.edu wrote:



 On Tue, Sep 4, 2012 at 2:20 PM, Paul Tremblay
 paulhtremb...@gmail.com mailto:paulhtremb...@gmail.com wrote:


 The following Python code:

  ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)

 Produces this error with Python 3.2:

 Traceback (most recent call last):
File scripts/audit_reports_weekly.py, line 150, in module
  ax.fill_between(dates, lower, upper, facecolor='gray',
 alpha=0.5)
File
 
 /home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/matplotlib/axes.py,
 line 6741, in fill_between
  y1 = ma.masked_invalid(self.convert_yunits(y1))
File
 
 /home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/numpy/ma/core.py,
 line 2241, in masked_invalid
  condition = ~(np.isfinite(a))
 TypeError: ufunc 'isfinite' not supported for the input types,
 and the inputs could not be safely coerced to any supported
 types according to the casting rule ''safe''


 [Decimal('3619.900530366609820157812617'), .]

 If I change the list from type Decimal to type float, then I
 don't get the error. Likewise, if I use Python 2.7, I also don't
 get an error.

 After reading over the error message, I realize that this error
 really results because of numpy, not matplotlib. But I'll go
 ahead and post this message, in case you are unaware of the
 problem.


 Just a quick note, mpl v1.1.x is not officially supported for py3k.
 The upcoming release of v1.2.0 will be the first official release
 with such support.

 That being said, it probably would be a good idea to make sure where
 the bug lies for this one (numpy or matplotlib).  Which version of
 numpy are you using?

 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



--
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