Re: [Matplotlib-users] Development advice needed

2012-10-03 Thread Jianbao Tao
Thank you so much, Anthony. After weighing the options, I decided to go for
Tkinter. The major reason for this is portability. BTW, I checked out your
website. Those screenshots are quite impressive. :-)

Jianbao

On Wed, Oct 3, 2012 at 3:27 PM, Anthony Floyd wrote:

> Hi Jianbao,
>
> > Do you have any references, such as screen shots, gallery, examples, or
> > whatever?  I am very curious to see what people can do with matplotlib.
>
> If you can find a Windows machine (or a Windows VM) and stomach a 60
> MB download, visit
> http://www.convergent.ca/products/raven/downloads.html and grab the
> "RAVEN Viewer" and "Demo RAVEN Workspace". When starting the program
> for the first time, don't worry about selecting a license, select
> "Viewer Only". Open the demo file. All plotting, annotating, legends,
> etc are handled by matplotlib. wxPython provides the rest of the GUI
> elements. The entirety of the program except for the engineering
> backend (which isn't exposed in the viewer anyway) is written in
> Python.
>
> If you can't get to a Windows box, then just visit
> http://www.convergent.ca/raven to get a sense of the application.
>
> Cheers,
> Anthony.
>
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Development advice needed

2012-10-03 Thread Anthony Floyd
Hi Jianbao,

> Do you have any references, such as screen shots, gallery, examples, or
> whatever?  I am very curious to see what people can do with matplotlib.

If you can find a Windows machine (or a Windows VM) and stomach a 60
MB download, visit
http://www.convergent.ca/products/raven/downloads.html and grab the
"RAVEN Viewer" and "Demo RAVEN Workspace". When starting the program
for the first time, don't worry about selecting a license, select
"Viewer Only". Open the demo file. All plotting, annotating, legends,
etc are handled by matplotlib. wxPython provides the rest of the GUI
elements. The entirety of the program except for the engineering
backend (which isn't exposed in the viewer anyway) is written in
Python.

If you can't get to a Windows box, then just visit
http://www.convergent.ca/raven to get a sense of the application.

Cheers,
Anthony.

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug when zooming on multiple lines separated by None

2012-10-03 Thread Eric Firing
On 2012/10/03 8:11 AM, Charleux Ludovic wrote:
> Thanks for your multiple answers. I'll try the same manipulation with
> the 1.2 version as soon as possible. Concerning the debate between the
> use of None and numpy.nan, I tryed both methods before posting and they
> both lead to the same bug on my version. I'm using the None/numpy.nan
> trick to plot finite element 2D meshes (Matplotlib  allows very neat
> vectorial plots) and I often adjust xlim/ylim to magnify interesting
> zones and so this bug is everywhere. I'm not totally sure but I think
> the bug was not present in the 1.0.x versions I tested before.

Please--there is *no* None trick. This is not a debate. Please do *not* 
use None.  Use np.nan or a masked array.  Unless you go into the lower 
levels of the api, mpl will convert a floating-point array with nans 
into a masked array for operations such as auto-scaling.

If you must use an object array (e.g., as Ben notes, if you are using 
datetime objects--it must be something for which there is a registered 
converter, because at the plotting level mpl works with floats), then 
make it a masked array if you need to put gaps in it.  If that does not 
work, then it is a bug in the conversion process.  Masked arrays should 
work for any input type supported by mpl.

Eric

>
> Regards.
>
> Ludovic Charleux
>
> 2012/10/3 Benjamin Root mailto:ben.r...@ou.edu>>
>
>
>
> On Wed, Oct 3, 2012 at 1:02 PM, Phil Elson  > wrote:
>
> I don't get this on matplotlib/master (and therefore probably
> not on 1.2rc2).
>
> I'm pretty sure masked array line plotting was fixed at some
> point this release cycle (I cannot find the appropriate github
> issue to link to), so I suggest this is a known bug with 1.1.1
> and fixed in 1.2. Just to be clear, I am using the TkAgg
> backend, and there is a remote possiblity that this bug is
> backend dependent. Is there any chance you could test this with
> the latest release candidate?
>
> Many Thanks,
>
>
> This issue may be dependent upon which version of Numpy one is
> using.  As Eric pointed out, one should be getting an object array
> if you have a None in the list.  On top of that, I wouldn't be
> surprised if the different backends handled this object array
> differently.
>
> As far as I am concerned, using None in the list is the bug and is
> not only unsupported, but should be actively discouraged.  Use NaNs
> or masked arrays instead.
>
> (and to ward off the inevitable question, I would advise against
> explicitly checking for object arrays because there are times when
> it is correct to have such arrays, i.e., python decimal or datetime
> objects).
>
> Cheers!
> Ben Root
>
>
>
>
>
> --
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Control the position of a figure window

2012-10-03 Thread Gökhan Sever
I was after a similar issue once, and asked this question at SO:

http://stackoverflow.com/questions/7802366/matplotlib-window-layout-questions

Manual positioning is fine sometimes if I want to really place windows
side-by-side for comparison purposes. However it would be nicer if mpl were
to remember positions of figures so that it would place the new figures
exactly the same place where they were before closed.

Actually, I have similar complaint for other windows opened in my Fedora 16
(Gnome 3.2) system. Say for instance I start a gvim instance, then move its
window to my second monitor, but closing and re-opening it, the window's
position is restored to the first monitor. Same thing is for evince,
sometimes it opens pdf's on the first monitor, sometimes on the second,
randomly position at least for my observation. I don't know where to look
for a solution; in each specific program, or windows manager should handle
/ remember positions of windows on screens.

On Tue, Oct 2, 2012 at 9:38 PM, Jianbao Tao  wrote:

> Hi,
>
> Is it possible to specify the position of a figure window when one is
> created? This will be a killing feature if one wants to put the figure
> window at the right place in the screen automatically. It is annoying if
> ones has to drag a new figure to a comfortable place in the screen every
> time a new figure is created.
>
> Jianbao
>
>
> --
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>


-- 
Gökhan
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug when zooming on multiple lines separated by None

2012-10-03 Thread Charleux Ludovic
Thanks for your multiple answers. I'll try the same manipulation with the
1.2 version as soon as possible. Concerning the debate between the use of
None and numpy.nan, I tryed both methods before posting and they both lead
to the same bug on my version. I'm using the None/numpy.nan trick to plot
finite element 2D meshes (Matplotlib  allows very neat vectorial plots) and
I often adjust xlim/ylim to magnify interesting zones and so this bug is
everywhere. I'm not totally sure but I think the bug was not present in the
1.0.x versions I tested before.

Regards.

Ludovic Charleux

2012/10/3 Benjamin Root 

>
>
> On Wed, Oct 3, 2012 at 1:02 PM, Phil Elson  wrote:
>
>> I don't get this on matplotlib/master (and therefore probably not on
>> 1.2rc2).
>>
>> I'm pretty sure masked array line plotting was fixed at some point this
>> release cycle (I cannot find the appropriate github issue to link to), so I
>> suggest this is a known bug with 1.1.1 and fixed in 1.2. Just to be clear,
>> I am using the TkAgg backend, and there is a remote possiblity that this
>> bug is backend dependent. Is there any chance you could test this with the
>> latest release candidate?
>>
>> Many Thanks,
>>
>>
> This issue may be dependent upon which version of Numpy one is using.  As
> Eric pointed out, one should be getting an object array if you have a None
> in the list.  On top of that, I wouldn't be surprised if the different
> backends handled this object array differently.
>
> As far as I am concerned, using None in the list is the bug and is not
> only unsupported, but should be actively discouraged.  Use NaNs or masked
> arrays instead.
>
> (and to ward off the inevitable question, I would advise against
> explicitly checking for object arrays because there are times when it is
> correct to have such arrays, i.e., python decimal or datetime objects).
>
> Cheers!
> Ben Root
>
>
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Development advice needed

2012-10-03 Thread Jianbao Tao
Dear Anthony,

Thank you so much for your advice. I embedded my response below.

Jianbao

On Wed, Oct 3, 2012 at 10:49 AM, Anthony Floyd wrote:

> Hi Jianbao,
>
> First some context: at the company I work for, we've been using
> matplotlib to do much of what you want to do for the past 4 years. We
> have created our own application for plotting, interrogating, and
> manipulating time-series data coming from both simulations and
> measurements, although from a completely different domain (in our case
> it's virtual manufacturing of composite materials). In the past two
> years, we've also been using matplotlib to plot in more-or-less
> realtime data from a cloud industrial sensors (temperature, pressure,
> etc).
>
Do you have any references, such as screen shots, gallery, examples, or
whatever?  I am very curious to see what people can do with matplotlib.


> > After reading the matplotlib documents and trying out several little
> > examples for a few days, I now have a feeling that matplotlib at least
> has
> > most of the infrastructure ready for my purposes. One thing that bothers
> me
> > a little bit is that the plotting speed seems to be a little slow. But
> IDL
> > had the same problem in the first place too. As computers became faster
> and
> > faster, that problem just became less and less important. I expect the
> same
> > thing will happen to matplotlib too.
>
> This is true, matplotlib can be slow, particularly for large data sets
> and many data sets. The trick is to downsample (and use tiling if
> you're going to be panning around a lot) what you're actually plotting
> before handing it off to the plot. I think more recent versions of
> matplotlib handle some of this for you, but we've found that it's
> faster to do the downsampling ourselves.
>
As a matter of fact, I considered writing intermediate routines to handle
downsampling before feeding data in matplotlib. However, you will have to
do anti-alias filtering for that. So, I wasn't sure downsampling would
boost the speed anyway. But based on your experience, this is probably a
good idea. :-)

>
> > Now let me turn to technical stuff. What I want is a time-series plotting
> [...]
> > sufficient. Third, the system should have minimal dependencies for the
> sake
> > of portability and installation easiness. As for now, I don't want any
> > dependencies beyond numpy, scipy, and matplotlib. Ipython would be a
> highly
> > recommended tool, but the system should be just fine without it.
>
> You're going to need more than that. At the very least you're going to
> need a widget framework like wxPython, pyQT, pyGTK, or some such.
> These will provide you with all the window management, widget
> controls, and so on. Our preference is wxPython but YMMV.
>
One of my concerns about third-party widget framework is that sometimes it
is difficult to install them. In fact, I tried to install wxPython on my
Mac (10.8 OS X) last night, but didn't succeed. Another concern of mine is
that I don't know how efficient or how easy to interact with a thrid-party
widget framework from a python interpreter. However, again, based on your
reply, it doesn't seem to be a big issue after all.

>
> > After weighing all the options, I sense that I will probably be better
> off
> > to use the matplotlib library directly, rather than the convenient
> utilities
> > provided by pyplot. However, I am having a hard time to find good
> > instructions for using the matplotlib infrastructure. So, I would like to
> > hear some references on that. I also would like to hear general advice
> about
> > how to construct such a system so that its structure is consistent with
> > matplotlib conventions. Other comments and advice are warmly welcome too.
>
> Absolutely, you'll want to use the API rather than the utility
> functions. The best reference for that is the online documentation at
> matplotlib.org. In the past we've found the source code documentation
> (or, say, that generated by doxygen) more helpful than the Sphinx
> documentation, but frankly our matplotlib bits are pretty stable now
> and we haven't had to use the documentation for a while (perhaps it's
> better now).
>
> Good luck! We've been very happy with our design choices, and get
> nothing but positive feedback on how our plots look and feel.
> matplotlib and the amazing active community around it have everything
> to do with that.
>
I am very glad to hear that. :-)

>
> Anthony.
>
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo

Re: [Matplotlib-users] Bug when zooming on multiple lines separated by None

2012-10-03 Thread Benjamin Root
On Wed, Oct 3, 2012 at 1:02 PM, Phil Elson  wrote:

> I don't get this on matplotlib/master (and therefore probably not on
> 1.2rc2).
>
> I'm pretty sure masked array line plotting was fixed at some point this
> release cycle (I cannot find the appropriate github issue to link to), so I
> suggest this is a known bug with 1.1.1 and fixed in 1.2. Just to be clear,
> I am using the TkAgg backend, and there is a remote possiblity that this
> bug is backend dependent. Is there any chance you could test this with the
> latest release candidate?
>
> Many Thanks,
>
>
This issue may be dependent upon which version of Numpy one is using.  As
Eric pointed out, one should be getting an object array if you have a None
in the list.  On top of that, I wouldn't be surprised if the different
backends handled this object array differently.

As far as I am concerned, using None in the list is the bug and is not only
unsupported, but should be actively discouraged.  Use NaNs or masked arrays
instead.

(and to ward off the inevitable question, I would advise against explicitly
checking for object arrays because there are times when it is correct to
have such arrays, i.e., python decimal or datetime objects).

Cheers!
Ben Root
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug when zooming on multiple lines separated by None

2012-10-03 Thread Phil Elson
I don't get this on matplotlib/master (and therefore probably not on
1.2rc2).

I'm pretty sure masked array line plotting was fixed at some point this
release cycle (I cannot find the appropriate github issue to link to), so I
suggest this is a known bug with 1.1.1 and fixed in 1.2. Just to be clear,
I am using the TkAgg backend, and there is a remote possiblity that this
bug is backend dependent. Is there any chance you could test this with the
latest release candidate?

Many Thanks,




On 3 October 2012 17:47, Charleux Ludovic wrote:

> Hello Phil,
>
> Your example does not trigger the bug because you don't zoom or specifiy
> xlim/ylim so that some points are (far) out of the current axis. For
> example, if you just add these lines to your code, you'll have it:
>
>
> import matplotlib.pyplot as plt
> import numpy as np
> x = np.array([0, 1, None, 1, 0])
> y = np.array([0, 1, None, 0, 1])
> plt.plot(x, y)
> # Add this or zoom in the upper left corner.
> plt.xlim([0., 0.2])
> plt.ylim([.9, 1.1])
> plt.show()
>
> Here I see an horizontal line where I should see a 45° tilted line. And
> the nasty part of this bug is that it only affects lines declared with at
> least one None in them where continuous lines seem unaffected as shown here:
>
>
> import matplotlib.pyplot as plt
> import numpy as np
> x0 = np.array([0, 1])
> y0 = np.array([0, 1])
> x1 = np.array([1, 0])
> y1 = np.array([0, 1])
> plt.plot(x0, y0)
> plt.plot(x1, y1)
> # Add this
> plt.xlim([0., 0.2])
> plt.ylim([.9, 1.1])
> plt.show()
>
> I get a 45° line.
>
> Ludovic
>
> ps: I use matplotlib 1.1.1rc (stock version available on repositories) on
> Xubuntu 12.04 (precise) 64-bit
>
>
> 2012/10/3 Phil Elson 
>
>> This works for me with 1.2 (not tested before that):
>>
>>
>> import matplotlib.pyplot as plt
>> import numpy as np
>>
>>
>> x = np.array([0, 1, None, 1, 0])
>> y = np.array([0, 1, None, 0, 1])
>>
>> plt.plot(x, y)
>>
>> plt.show()
>>
>>
>>
>> I get two distinct lines crossing each other at (0.5, 0.5)
>>
>>
>> HTH,
>>
>
>
>
> --
>
>  *Ludovic Charleux*
> Assistant Professor
>
> *SYMME / Polytech' Annecy Chambery *
>   Domaine
> Universitaire, BP 80439
> Annecy
>  le vieux cedex, F74944 France
>   *Work:* 33 (0) 4 50 09 65 62
> *Fax:* 33 (0) 4 50 09 65 43
> *Email:* ludovic.charl...@univ-savoie.fr
>  *Professional Profile
> *
>  See who we know in 
> common 
> Want
> a signature like 
> this?
>
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Development advice needed

2012-10-03 Thread Sterling Smith
Jianbao,

The one thing I would add to Anthony's response, which is a good summary of 
what I would say, is that you should look into the animation aspects of 
matplotlib, and the xdata and ydata attributes of lines/axes for speed in 
replotting mostly similar situations.  I regret having not learned of these 
before I made an application, and I have yet to go back and implement these 
faster methods.

-Sterling

On Oct 3, 2012, at 9:49AM, Anthony Floyd wrote:

> Hi Jianbao,
> 
> First some context: at the company I work for, we've been using
> matplotlib to do much of what you want to do for the past 4 years. We
> have created our own application for plotting, interrogating, and
> manipulating time-series data coming from both simulations and
> measurements, although from a completely different domain (in our case
> it's virtual manufacturing of composite materials). In the past two
> years, we've also been using matplotlib to plot in more-or-less
> realtime data from a cloud industrial sensors (temperature, pressure,
> etc).
> 
>> After reading the matplotlib documents and trying out several little
>> examples for a few days, I now have a feeling that matplotlib at least has
>> most of the infrastructure ready for my purposes. One thing that bothers me
>> a little bit is that the plotting speed seems to be a little slow. But IDL
>> had the same problem in the first place too. As computers became faster and
>> faster, that problem just became less and less important. I expect the same
>> thing will happen to matplotlib too.
> 
> This is true, matplotlib can be slow, particularly for large data sets
> and many data sets. The trick is to downsample (and use tiling if
> you're going to be panning around a lot) what you're actually plotting
> before handing it off to the plot. I think more recent versions of
> matplotlib handle some of this for you, but we've found that it's
> faster to do the downsampling ourselves.
> 
>> Now let me turn to technical stuff. What I want is a time-series plotting
> [...]
>> sufficient. Third, the system should have minimal dependencies for the sake
>> of portability and installation easiness. As for now, I don't want any
>> dependencies beyond numpy, scipy, and matplotlib. Ipython would be a highly
>> recommended tool, but the system should be just fine without it.
> 
> You're going to need more than that. At the very least you're going to
> need a widget framework like wxPython, pyQT, pyGTK, or some such.
> These will provide you with all the window management, widget
> controls, and so on. Our preference is wxPython but YMMV.
> 
>> After weighing all the options, I sense that I will probably be better off
>> to use the matplotlib library directly, rather than the convenient utilities
>> provided by pyplot. However, I am having a hard time to find good
>> instructions for using the matplotlib infrastructure. So, I would like to
>> hear some references on that. I also would like to hear general advice about
>> how to construct such a system so that its structure is consistent with
>> matplotlib conventions. Other comments and advice are warmly welcome too.
> 
> Absolutely, you'll want to use the API rather than the utility
> functions. The best reference for that is the online documentation at
> matplotlib.org. In the past we've found the source code documentation
> (or, say, that generated by doxygen) more helpful than the Sphinx
> documentation, but frankly our matplotlib bits are pretty stable now
> and we haven't had to use the documentation for a while (perhaps it's
> better now).
> 
> Good luck! We've been very happy with our design choices, and get
> nothing but positive feedback on how our plots look and feel.
> matplotlib and the amazing active community around it have everything
> to do with that.
> 
> Anthony.
> 
> --
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug when zooming on multiple lines separated by None

2012-10-03 Thread Eric Firing
On 2012/10/03 4:24 AM, Charleux Ludovic wrote:
> Hello,
>
> I want to plot multiple lines using matplotlib.pyplot.plot using the
> None separator: when i zoom or plot lines that go far away from the axis
> limits, they their direction is changed. I encounter a bug shown by the
> folowing code:
>
> import matplotlib.pyplot as plt
>
> # Single line
> x = [0., 1., 1., 0., 0.]
> y = [0., 0., 1., 1., 0.]
>
> # Multiple lines separated by None
> x2 = [0., 1., None ,1., 0.]
> y2 = [0., 0., None, 1., 1.]

I'm surprised this works at all.  I don't think we have ever 
intentionally supported object arrays, which is what you get when you 
take np.array() of a list with a None in it.

If you want to use this method to make a set of line segments, use 
np.nan in place of None.

Eric

>
> # Let's plot
> fig = plt.figure(0)
> plt.clf()
> ax = fig.add_subplot(121)
> plt.title('No zoom')
> plt.xlim([-1, 2])
> plt.ylim([-1, 2])
> plt.plot(x,y, 'bo-', label = 'This is ok')
> plt.plot(x2,y2, 'ro-', label = 'This is not ok')
> plt.legend()
> ax = fig.add_subplot(122)
> plt.title('With zoom one a corner')
> plt.xlim([-.05, .1])
> plt.ylim([.95, 1.05])
> plt.plot(x,y, 'bo-', label = 'This is ok')
> plt.plot(x2,y2, 'ro-', label = 'This is not ok')
> plt.legend()
> plt.show()
>
> I tried several approaches to solve the problem but never succeeded. I
> don't wich to use 2D arrays or LineCollections because this solution is
> faster and allows the declaration of all lines with a single label and
> color. Has anyone any idea ?
>
> Regards.
>
>
>
>
> --
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Development advice needed

2012-10-03 Thread Anthony Floyd
Hi Jianbao,

First some context: at the company I work for, we've been using
matplotlib to do much of what you want to do for the past 4 years. We
have created our own application for plotting, interrogating, and
manipulating time-series data coming from both simulations and
measurements, although from a completely different domain (in our case
it's virtual manufacturing of composite materials). In the past two
years, we've also been using matplotlib to plot in more-or-less
realtime data from a cloud industrial sensors (temperature, pressure,
etc).

> After reading the matplotlib documents and trying out several little
> examples for a few days, I now have a feeling that matplotlib at least has
> most of the infrastructure ready for my purposes. One thing that bothers me
> a little bit is that the plotting speed seems to be a little slow. But IDL
> had the same problem in the first place too. As computers became faster and
> faster, that problem just became less and less important. I expect the same
> thing will happen to matplotlib too.

This is true, matplotlib can be slow, particularly for large data sets
and many data sets. The trick is to downsample (and use tiling if
you're going to be panning around a lot) what you're actually plotting
before handing it off to the plot. I think more recent versions of
matplotlib handle some of this for you, but we've found that it's
faster to do the downsampling ourselves.

> Now let me turn to technical stuff. What I want is a time-series plotting
[...]
> sufficient. Third, the system should have minimal dependencies for the sake
> of portability and installation easiness. As for now, I don't want any
> dependencies beyond numpy, scipy, and matplotlib. Ipython would be a highly
> recommended tool, but the system should be just fine without it.

You're going to need more than that. At the very least you're going to
need a widget framework like wxPython, pyQT, pyGTK, or some such.
These will provide you with all the window management, widget
controls, and so on. Our preference is wxPython but YMMV.

> After weighing all the options, I sense that I will probably be better off
> to use the matplotlib library directly, rather than the convenient utilities
> provided by pyplot. However, I am having a hard time to find good
> instructions for using the matplotlib infrastructure. So, I would like to
> hear some references on that. I also would like to hear general advice about
> how to construct such a system so that its structure is consistent with
> matplotlib conventions. Other comments and advice are warmly welcome too.

Absolutely, you'll want to use the API rather than the utility
functions. The best reference for that is the online documentation at
matplotlib.org. In the past we've found the source code documentation
(or, say, that generated by doxygen) more helpful than the Sphinx
documentation, but frankly our matplotlib bits are pretty stable now
and we haven't had to use the documentation for a while (perhaps it's
better now).

Good luck! We've been very happy with our design choices, and get
nothing but positive feedback on how our plots look and feel.
matplotlib and the amazing active community around it have everything
to do with that.

Anthony.

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Development advice needed

2012-10-03 Thread Jianbao Tao
Dear all,

As some of you might have noticed, I am asking questions frequently
recently, most of which are naive ones. The reason for this is that I
recently decided to develop a  satellite data viewer with matplotlib, and I
am new to both python and matplotlib.

Here is a little background of this decision. I am a postdoc in the space
physics field, where a lot of people watch and analyze satellite data for a
living. The data are time-series data by nature. As for now, a lot of
people use packages based on IDL to navigate their data. I myself is one of
them too. For now. :-) One big problem with IDL is that it is very
expensive because it doesn't have a broad enough user base to drive their
cost down. Another big problem is that the company that is developing IDL
doesn't seem to work in the right direction. For example, more than 99% of
the time of more than 99% of the IDL users use the so-called direct
graphics system in IDL, but IDL hasn't upgraded this system since, I don't
know, maybe early 90s. Compared to what matplotlib can offer, the on-screen
graphics quality of the IDL direct graphics is simply "ugly", which is a
big reason why I want to switch to matplotlib. There are also some other
frequently-used nice features in matplotlib that IDL doesn't have.

After reading the matplotlib documents and trying out several little
examples for a few days, I now have a feeling that matplotlib at least has
most of the infrastructure ready for my purposes. One thing that bothers me
a little bit is that the plotting speed seems to be a little slow. But IDL
had the same problem in the first place too. As computers became faster and
faster, that problem just became less and less important. I expect the same
thing will happen to matplotlib too.

Now let me turn to technical stuff. What I want is a time-series plotting
system like the following. First, it manages all the figure windows it
generates, including the positions and looks of the figure windows. A
common use case for such a system would be that the user is also analyzing
the data while watching the time-series data,and hence the user likely
needs to plot some temporary results, such as a snapshot of particle
distribution function, but doesn't want to screw up the time-series plot.
Therefore, it will be nice that the plotting windows of the time-series
data are managed particularly. Second, it should come with a navigation
toolbar that facilitates the data navigation. The current navigation
toolbar widget is nice and probably suit more than 50% percent of my needs,
but it's not sufficient. Third, the system should have minimal dependencies
for the sake of portability and installation easiness. As for now, I don't
want any dependencies beyond numpy, scipy, and matplotlib. Ipython would be
a highly recommended tool, but the system should be just fine without it.

After weighing all the options, I sense that I will probably be better off
to use the matplotlib library directly, rather than the convenient
utilities provided by pyplot. However, I am having a hard time to find good
instructions for using the matplotlib infrastructure. So, I would like to
hear some references on that. I also would like to hear general advice
about how to construct such a system so that its structure is consistent
with matplotlib conventions. Other comments and advice are warmly welcome
too. :-)

Thank you very much for reading this far.

Jianbao
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug when zooming on multiple lines separated by None

2012-10-03 Thread Phil Elson
This works for me with 1.2 (not tested before that):


import matplotlib.pyplot as plt
import numpy as np


x = np.array([0, 1, None, 1, 0])
y = np.array([0, 1, None, 0, 1])

plt.plot(x, y)

plt.show()



I get two distinct lines crossing each other at (0.5, 0.5)


HTH,

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Black and white mode

2012-10-03 Thread Michael Droettboom
I've been thinking a lot lately about how CSS could be used to specify 
styles in matplotlib.  It would allow one to specify any set of styles 
to cycle through (colors, linestyles, whatever other properties).


   axes.nth-child(0) { color: blue }
   axes.nth-child(1) { color: green }

vs.

   axes.nth-child(0) { dashes: dotted }
   axes.nth-child(1) { dashed: dashed }

The obstacles to integrating something like that are that a) matplotlib 
currently doesn't maintain the fact that a plot's style was "unset" at 
the time of creation, and b) the heirarchy of plot objects is a little 
tangled, so it would be hard to specify using CSS selectors what should 
be styled.


It does keep popping up in my brain as a clean and complete solution to 
the problem of styling, but there would need to be a number of changes 
to the internal plumbing to make it work.


Mike

On 10/03/2012 08:48 AM, Benjamin Root wrote:



On Tue, Oct 2, 2012 at 11:37 AM, Tony Yu > wrote:




On Tue, Oct 2, 2012 at 11:04 AM, Benjamin Root mailto:ben.r...@ou.edu>> wrote:



On Tue, Oct 2, 2012 at 8:31 AM, William Furnass
mailto:w...@thearete.co.uk>> wrote:

Did anything ever come of the MPL black and white mode
mentioned in
the following?  I rarely want to produce colour plots and
having an
inbuilt mechanism for cycling through line styles that can be
activated with a keyword argument would be very handy.


http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg00367.html

Cheers,

Will


Perhap's Tony Yu's mpltools might be the closest we have
gotten to this goal.  There has been a number of technical
hurdles that I have not had the time or resources to iron
out.  Hopefully, it will be helpful to you.

http://tonysyu.github.com/mpltools/getting_started.html

Cheers!
Ben Root


Thanks for the advertisement Ben ;)

Will: If you're just interested in grayscale plotting, here's a
direct link to the example:

http://tonysyu.github.com/mpltools/auto_examples/style/plot_grayscale.html

The discussion that you link to talks specifically about line
styles. In the past there's been discussion of adding a linestyle
cycle rc param, but I don't think there's been progress on that front.

BTW, Ben: are you still thinking about some sort of hierarchical
configuration management? I think it'd make a great MEP, if you
find the time.


Not necessarily a hierarchical config management, but rather a 
hierarchical property management.  Of course, this was before I 
discovered GraphicsContext, which makes me wonder if it could be 
generalized and moved out of the backends to serve such a purpose.


Of course, with regards to rcparams, we definitely need to re-examine 
how we are doing it right now before it gets too bloated...


Ben Root



--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev


___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Black and white mode

2012-10-03 Thread Ignas Anikevicius
On 02/10/12 11:37:50 -0400, Tony Yu wrote:
> [...snip...]
>
> The discussion that you link to talks specifically about line styles. In
> the past there's been discussion of adding a linestyle cycle rc param, but
> I don't think there's been progress on that front.
> 
> [...snip...]
> 

Just wanted to pop in and say, that I'd like the linestyle cycle rc
param as well. :)

All the best,

Ignas A.

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Create a figure window without navigation toolbar

2012-10-03 Thread Phil Elson
Personally, I am not a fan of adding a window specific keyword to the
figure function (although there may be some there already).
With 1.2 you can use Matthew Emmett/Paul Ivanov's awesome new context
manager to remove the toolbar for the duration of the with statement:


import matplotlib.pyplot as plt
import matplotlib as mpl

with mpl.rc_context({'toolbar':False}):
plt.plot(range(10))
plt.show()


Does that make things easier/nicer for you?

Cheers,

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Eclipse with PyDev on Ubuntu - updating matplotlib version in eclipse ide

2012-10-03 Thread Harshad Surdi
Hi,
I am using Eclipse IDE for Java Developers with PyDev on Ubuntu 12.04 and I
am quite new to Ubuntu and Eclipse. Can you guide me as to hos to update
matplotlib in PyDev in Eclipse?

-- 
Best Regards,
Harshad Surdi
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Create a figure window without navigation toolbar

2012-10-03 Thread Benjamin Root
On Tue, Oct 2, 2012 at 11:09 PM, Jianbao Tao  wrote:

> Hi,
>
> I know one can make a figure window without toolbar by doing
> mpl.rcParams['toolbar'] = 'None'
>
> However, this approach is kind of annoying if one just wants to remove the
> toolbar for one figure window and to keep the default behavior to be with a
> toolbar. So, I am wondering if it is possible to do something like:
> fig = figure(toolbar=False) # Create a new figure window with no toolbar.
>
> If it is not possible now, I am wondering if the matplotlib team has any
> intention to implement that feature. I would think it is not hard to do so,
> since it is so easy to achieve that goal by setting a parameter. But I
> could very much be wrong, as I know nothing about how things work under the
> hood for matplotlib.
>
> Anyway, I am mostly just curious, since I have already got a workaround
> for that. But it would be nice to know other's people's approaches/ideas.
> :-)
>
> Thank you very much.
>

Actually, such a feature shouldn't be too difficult to add.  Why don't you
make a feature request for it on github and you might see it added for v1.3.

Cheers!
Ben Root
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Control the position of a figure window

2012-10-03 Thread Benjamin Root
On Tue, Oct 2, 2012 at 11:38 PM, Jianbao Tao  wrote:

> Hi,
>
> Is it possible to specify the position of a figure window when one is
> created? This will be a killing feature if one wants to put the figure
> window at the right place in the screen automatically. It is annoying if
> ones has to drag a new figure to a comfortable place in the screen every
> time a new figure is created.
>
> Jianbao
>
>
Jianbao,

This question has come up before, and I have never really felt that a good
solution was ever given.  However, here are some discussions and some
solutions for it.

http://stackoverflow.com/questions/7449585/how-do-you-set-the-absolute-position-of-figure-windows-with-matplotlib
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14387.html
http://stackoverflow.com/questions/11336835/ask-window-manager-to-place-matplotlib-plot-windows-always-on-top

I know there are more discussions than this, mostly related to controlling
your window manager, but I can't seem to find them right now.

Cheers!
Ben Root
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Black and white mode

2012-10-03 Thread Benjamin Root
On Tue, Oct 2, 2012 at 11:37 AM, Tony Yu  wrote:

>
>
> On Tue, Oct 2, 2012 at 11:04 AM, Benjamin Root  wrote:
>
>>
>>
>> On Tue, Oct 2, 2012 at 8:31 AM, William Furnass wrote:
>>
>>> Did anything ever come of the MPL black and white mode mentioned in
>>> the following?  I rarely want to produce colour plots and having an
>>> inbuilt mechanism for cycling through line styles that can be
>>> activated with a keyword argument would be very handy.
>>>
>>>
>>> http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg00367.html
>>>
>>> Cheers,
>>>
>>> Will
>>>
>>>
>> Perhap's Tony Yu's mpltools might be the closest we have gotten to this
>> goal.  There has been a number of technical hurdles that I have not had the
>> time or resources to iron out.  Hopefully, it will be helpful to you.
>>
>> http://tonysyu.github.com/mpltools/getting_started.html
>>
>> Cheers!
>> Ben Root
>>
>
> Thanks for the advertisement Ben ;)
>
> Will: If you're just interested in grayscale plotting, here's a direct
> link to the example:
>
>
> http://tonysyu.github.com/mpltools/auto_examples/style/plot_grayscale.html
>
> The discussion that you link to talks specifically about line styles. In
> the past there's been discussion of adding a linestyle cycle rc param, but
> I don't think there's been progress on that front.
>
> BTW, Ben: are you still thinking about some sort of hierarchical
> configuration management? I think it'd make a great MEP, if you find the
> time.
>
>
Not necessarily a hierarchical config management, but rather a hierarchical
property management.  Of course, this was before I discovered
GraphicsContext, which makes me wonder if it could be generalized and moved
out of the backends to serve such a purpose.

Of course, with regards to rcparams, we definitely need to re-examine how
we are doing it right now before it gets too bloated...

Ben Root
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to modify the navigation toolbar easily in a matplotlib figure window?

2012-10-03 Thread Phil Elson
> Note, however, code has been improved for the 1.2.0 release to make it
easier to modify the set of buttons that are used.  In backend_bases.py,
look for the NavigationToolbar2 class.

Ah yes! I knew I did that for a good reason. :-) Good thinking Ben!
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Black and white mode

2012-10-03 Thread Will Furnass
On Tue, 02 Oct 2012 11:37:50 -0400, Tony Yu wrote:

>> On Tue, Oct 2, 2012 at 8:31 AM, William Furnass
>> wrote:
>>
>>> Did anything ever come of the MPL black and white mode mentioned in
>>> the following?  I rarely want to produce colour plots and having an
>>> inbuilt mechanism for cycling through line styles that can be
>>> activated with a keyword argument would be very handy.
>>>
>>> http://www.mail-archive.com/matplotlib-users-5NWGOfrQmneRv
+lv9mx5uipxlwaov...@public.gmane.org/msg00367.html
> 
> Will: If you're just interested in grayscale plotting, here's a direct
> link to the example:
> 
> http://tonysyu.github.com/mpltools/auto_examples/style/
plot_grayscale.html
> 
> The discussion that you link to talks specifically about line styles. In
> the past there's been discussion of adding a linestyle cycle rc param,
> but I don't think there's been progress on that front.

Ben, Tony: thanks for the info. mpltools is new to me, very much like the 
idea of being able to enable stylesheets for specific plots.

+1 for linestyle cycling.  I've been impressed with Sigmaplot's default 
choices of line styles when producing B&W figures and would love it if 
such behaviour were easily accessible in MPL.

Cheers,

Will 


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users