[Matplotlib-users] matplotlib 0.98.5.3 windows binaries available

2009-06-14 Thread John Hunter
The windows binaries for the latest matplotlib release are now
available for download at

  https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=278194

for python2.5 and 2.6 (if you need 2.4 please respond here).  Sorry
for the delay, but we hit a nasty python2.6/libpng/mingw that held us
up.  Thanks to Christoph Gohlke
for the visual studio builds and Charlie Moad for the MingW framework.

Please let us know if you have any troubles.

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Python 2.6.2 installation?

2009-06-14 Thread John Hunter
On Fri, Jun 12, 2009 at 6:44 PM, Christoph Gohlke wrote:
> Here are the Windows installer and egg produced by "setup.py bdist_wininst"
> respectively "setupegg.py bdist_egg":


Thanks Christoph -- I've uploaded these to the sf site.  After the
next trunk release, I may ask you again to provide some visual studio
builds if you have the time, since the mingw/python2.6 problems have
not been solved yet.

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib 0.98.5.3 windows binaries available

2009-06-15 Thread John Hunter
On Mon, Jun 15, 2009 at 7:38 AM, CaseyWeb wrote:

> I installed this on python 2.6.2 using the windows installer (the .exe) but
> it crashes even on something as
> simple as importing pylab from the interactive prompt.  To make sure it
> wasn't a conflict with other packages, I created a clean virtualenv
> directory and installed matplotlib from the 2.6 egg, but the results are the
> same.  Trying to run any matplotlib example immediately creates a windows
> exception dialog.

Apparently the binaries are fine but the default matplotlib rc is
setting the backend to wxagg.  site-packages/matplotlib/mpl-data and
set

backend : TkAgg

See also http://matplotlib.sourceforge.net/users/customizing.html

Christoph, would you be able to rebuild the installers using TkAgg as
the default backend?  Basically, at build time, you need to copy
setup.cfg.template to setup.cfg and set the line

backend = TkAgg

There are additional details at

  http://matplotlib.sourceforge.net/devel/release_guide.html#packaging

and

  http://matplotlib.sourceforge.net/faq/installing_faq.html#backends


Thanks!
JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] change a matplotlib.lines.Line2D and update the plot

2009-06-15 Thread John Hunter
On Mon, Jun 15, 2009 at 9:36 AM, TP wrote:
> Hi everybody,
>
> I want to modify a matplotlib.lines.Line2D and update the plot.
> I have used Line2D._y member to modify the line. It works. But by doing
> canvas.draw() (see example below), the line is not updated on the plot. To
> update it, I have to do autoscale_view(). But I do not want the x and y
> ranges of the plot to be changed.

Turn autoscaling off with

  ax.set_autoscale_on(False)

update the line with

  line.set_ydata(newdata)

draw the canvas with

  fig.canvas.draw()

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib 0.98.5.3 windows binaries available

2009-06-15 Thread John Hunter
On Mon, Jun 15, 2009 at 10:12 AM, CaseyWeb wrote:
>
> I do have wxPython 2.8 installed so I don't know why this would have caused
> the problem in the first place, but I changed the matplotlibrc to backend :
> TkAgg and I still get the windows crash.  Just to be clear, this isn't an
> import error or simple python exit; I'm actually getting the Windows crash
> dialog box whenever I import pylab.  Importing matplotlib doesn't seem to
> cause any problems, but I haven't tried to do anything with it yet.

make sure you have a clean installation by removing
site-packages/matplotlib and any associated eggs.  I tried the exe
installer and got the wxpython traceback.  I switched to tkagg and was
able to make plots, save pngs, etc.

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib 0.98.5.3 windows binaries available

2009-06-15 Thread John Hunter
On Mon, Jun 15, 2009 at 10:31 AM, Christoph Gohlke wrote:
> Hi John,
>
> I rebuilt the installer and egg and confirmed that the distributed
> matplotlibrc file contains "backend: TkAgg".
>
> 
>
> 

Great -- thanks a lot.  I have uploaded these to the sf site and
tested both the egg and exe and both are working out-of-the-box on my
system at least.

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] dynamic image update

2009-06-16 Thread John Hunter
On Tue, Jun 16, 2009 at 11:42 AM, Randy Heiland wrote:
> Can someone point me to the "best" way to dynamically update a 2D
> [image] array (think of cellular automata)?  E.g., this simple example
> works, but gets sluggish after several iterations:

Use im.set_array rather than making multiple calls to imshow.  See the
"dynamic_image*" examples at

http://matplotlib.sourceforge.net/examples/animation/index.html

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] dynamic image update

2009-06-16 Thread John Hunter
On Tue, Jun 16, 2009 at 3:32 PM, Sebastian Haase
wrote:> On Tue, Jun 16, 2009 at 6:54 PM, John
Hunter wrote:

> Is there a similar function (to im.set_array) for graph plots ?

for lines you would use line.set_data (or set_ydata, set_xdata).  Eg

http://matplotlib.sourceforge.net/examples/animation/simple_anim_tkagg.html

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Updating tick labels when using animation

2009-06-17 Thread John Hunter
On Wed, Jun 17, 2009 at 5:27 PM, Elan Pavlov wrote:
> Hi,
> I'm using an animated graph in which most of the time I don't want it
> to autoscale (due to speed). Once in a while I want it to change the
> limits of the y-axis. In order to do this I use set_ylim and follow by
> a canvas.draw(). However it does not actually redraw the canvas and
> the old tick labels remain (although the scales are reset). When I
> manually resize the canvas in updates the tick labels. Any ideas what
> I'm doing wrong?

This doesn't sound right -- a call to canvas.draw should redraw the
whole canvas cleanly, with the exception of Artists where the animated
property is set.  Can you reduce your code to a free-standing example
that we can run?

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hexbin extent Attribute Error

2009-06-17 Thread John Hunter
On Wed, Jun 17, 2009 at 5:31 PM, Alexandar Hansen wrote:
> Hello,
>
> I've been having fun using hexbin, but I'd like to have consistent bin sizes
> and plot ranges for different sets of data. What I'm finding is that the bin
> sizes are primarily determined by the input data mins and maxes. For
> instance, I'm plotting data with something like:

Instead of a "something like" could you please post a complete example
that we can run so we can replicate the error.  This saves us a lot of
time.  Also, please report any version info, as described at

http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem

For example, the following runs for me using mpl svn:

import numpy as np
import matplotlib.cm as cm
import  matplotlib.pyplot as plt

n = 10
x = np.random.standard_normal(n)
y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
xmin = x.min()
xmax = x.max()
ymin = y.min()
ymax = y.max()

plt.subplots_adjust(hspace=0.5)
plt.subplot(121)
plt.hexbin(x,y, cmap=cm.jet, extent=[xmin, xmax, ymin, ymax])
plt.axis([xmin, xmax, ymin, ymax])
plt.title("Hexagon binning")
cb = plt.colorbar()
cb.set_label('counts')

plt.subplot(122)
plt.hexbin(x,y,bins='log', cmap=cm.jet)
plt.axis([xmin, xmax, ymin, ymax])
plt.title("With a log color scale")
cb = plt.colorbar()
cb.set_label('log10(N)')

plt.show()

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Reminder to vote in the SF Community Choice awards

2009-06-24 Thread John Hunter
On Tue, Jun 23, 2009 at 8:59 AM, Kaushik
Ghose wrote:
> Matplotlib made it past the nomination stage and is one of the finalists in 
> the
> 'best project for academia' category. Don't forget to register your vote!
>
> http://sourceforge.net/community/cca09/vote/

Thanks Gaushik -- I also put a link in the sidebar on our homepage
that you can click on to vote.  The link below will  preselect mpl to
make your voting a little easier :-)

http://sf.net/community/cca09/vote/?f=379

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Missing files on the web documentation

2009-06-27 Thread John Hunter
On Sat, Jun 27, 2009 at 1:44 AM, LB wrote:

> I thing there should be some links on the web pages to download theses
> files.
> At least, it should be said in the docstring where to find them, don't you
> think ?

It would be a good idea -- but for now you can grab the source
distribution *.tar.gz from the download page and look in the
"examples" subdirectory.  All the code, data and support files are
there (the web examples are automatically built from this directory).
If you are on a linux/unix box or any box that has an svn client, the
easiest way is to just check out::

  svn co 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib
matplotlib
  cd mpl/examples

or if you just want the examples rather than the whole source tree::

  > svn co 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib/examples
mpl_examples

but I suggest getting the source because some of the examples only run
on svn and you may want to install from svn to use them

  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn


JDH

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [matplotlib-devel] crazy ideas for MPL

2009-07-02 Thread John Hunter
On Thu, Jul 2, 2009 at 1:00 PM, Pierre GM wrote:
> Eh, can I play ?
> * Something I'd really like to see is a way to access a given patch/
> line/collection/... by a string (a name) instead of having to find the
> corresponding element in a list. That would mean converting lists into
> dictionaries, or at least provide a way to map the list to a dictionary.
> An example of application would be "del lines['first']" to delete the
> line named 'first'. By default, if no name is explicitly given to an
> object, we could use the order in which it is drawn...
>

Take a look at findobj with an arbitrary match function (eg set the
label property on the obj you want to find and then call find obj with
a function that checks the label)

http://matplotlib.sourceforge.net/examples/pylab_examples/findobj_demo.html

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] a tiny addition to acorr

2009-07-11 Thread John Hunter
On Fri, Jul 10, 2009 at 3:09 PM, Michael Lerner wrote:
> Hi,
>
> I was looking at the autocorrelation of a time series recently and it was
> useful to scale the x-axis (i.e. multiply lags by the timestep of my actual
> data). It's a trivial change, but it might be useful for others. Here's a
> standalone version of axes.acorr:
>

I'd be happy to consider a patch to acorr/xcorr ro add a new kwarg,
but is should be submitted as an svn patch which also includes
documentation.  I don't think we need to add a new function to support
this, just enhance the existing ones.  See

  http://matplotlib.sourceforge.net/faq/howto_faq.html#submit-a-patch

Thanks,
JDH


> def scaledacorr(x, stepsize=1, normed=False, detrend=mlab.detrend_none,
>     usevlines=False, maxlags=None, **kwargs):
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] : ( Problem With atplotlib.pyplot.plotfile : IndexError: list index out of range

2009-07-11 Thread John Hunter
2009/7/5 s.s C :
> when i ploted column data from an ASCII space delimited file :
>
> import matplotlib.pyplot as plt
> plt.plotfile('data.txt',cols=(0,1), delimiter=' ')

Works fine for me -- perhaps you can attach your file rather than
paste your data and let us know your platform details.  Could be a
unix/dos line ending problem or a unicode problem.  Not really sure
but it might help to see the raw data.

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Remove box around legend?

2009-07-11 Thread John Hunter
On Thu, Jul 9, 2009 at 5:56 PM, Joseph Smidt wrote:
> Thank you!  That did it.  I thought I read the webpage you sent 10
> times, but didn't even notice.  Thanks.
>
> On Thu, Jul 9, 2009 at 3:38 PM, Chaitanya Krishna wrote:
>> Hi,
>>
>> legend.draw_frame(False) should do the trick. Check out
>> http://matplotlib.sourceforge.net/api/artist_api.html?highlight=draw_frame#matplotlib.legend.Legend.draw_frame


I often set the alpha on the frame so it is translucent, which in some
cases is preferable to turning the frame off entirely::

  leg = ax.legend(fancybox=True)
  leg.get_frame().set_alpha(0.5)

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] legend outside axes

2009-07-11 Thread John Hunter
On Sat, Jul 11, 2009 at 6:06 AM, Eli Brosh wrote:
> Hello,
> I encountered a problem when trying to draw a legend outside the axes.
> For some reason, when the legend is placed outside the axes, the markers are
> not drawn near the labels.
>
> I attach two scripts and two corresponding figures.
> the only differences between the scripts is the location of the legend.
> When the legend is placed inside the axes, everything is OK.
> However, when the legend is outside the markers are gone.
>
> Is this a bug ?
> Is there a way around it ?

I am not seeing this problem in mpl svn (what version are you using).
perhaps you can upgrade to svn?

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Render image to string

2009-07-11 Thread John Hunter
On Tue, Jul 7, 2009 at 6:41 PM, Doug Penner wrote:

> so instead of doing
>
>    plt.savefig("some/location.png")
>
>    return HttpResponse(" />")
>
> I could do
>
>    return HttpResponse(plt.image_render('image/png'), mimetype="image/png")
>
> and not have to worry about deleting the image later (there are LOT that
> get generated)

You can save directly to a file handle (eg sys.stdout) so you need not
go to a PNG file.  Alternatively, you can write to a StringIO object.
See the examples at

  
http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server

And if you would be willing to complete the FAQ stub for Django

  http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-with-django

That would be much appreciated.  See

  http://matplotlib.sourceforge.net/faq/howto_faq.html#how-to-contribute-docs

Thanks,
JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] title when using subplot

2009-07-11 Thread John Hunter
On Mon, Jul 6, 2009 at 10:35 AM, jcm52 wrote:
>
> Perhaps this is a new feature since you sent this request, but I just came
> across
>
> pylab.suptitle('my super title')
>
> Seems to work fairly well, but the font sizes don't appear to behave as well
> as I'd like.

Just pass in the fontsize kwarg:

  pylab.suptitle('my super title', fontsize=14)

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem plotting with matplotlib on ActivePython

2009-07-11 Thread John Hunter
On Tue, Jul 7, 2009 at 9:53 AM, Voichek wrote:
>
> Hi everyone,
>
> I just installed matplotlib (after suffering from Numpy, Scipy, Atlas,
> Lapack...), and I have this weird problem.
>
> When I plot the first time I have no problem, the plot comes out just fine
> and the plot window is interactive.
> After I close the plotting window and try to plot again I can see the graph
> but the plot window doesn't response (not interactive).
>
> When I import pylab I get this warning:
 import pylab
>
> Warning (from warnings module):
>  File
> "/home/yoavv/ActivePython-2.6_64/lib/python2.6/site-packages/pytz/tzinfo.py",
> line 5
>    from sets import Set
> DeprecationWarning: the sets module is deprecated
 pylab.plot(range(100))
> []
 p = _
 pylab.show()
>
 pylab.plot(range(200))
> []
>
> - Here no response.
>
> I am using:
> - ActivePython-2.6
> - matplotlib 0.98.5.3
>
> I would appreciate any help,

Take a look at

http://matplotlib.sourceforge.net/users/shell.html

After you have digested the ideas there and make sure your interactive
and backend settings are proper for ActivePython, feel free to get
back to us with more questions.  Be sure to read the links
"Customizing matplotlib" and "What is a backend" referred to from the
page above.

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] half-filled markers

2009-07-11 Thread John Hunter
On Sat, Jul 11, 2009 at 3:43 AM, Eli Brosh wrote:
> Hello,
> A few weeks earlier I was asking whether it is possible to plot half-filled
> markers in matplotlib.
> As I got no answers I tried to do it myself.
> There are several ways to do it. For example, I considered following the
> example in
> http://matplotlib.sourceforge.net/examples/api/scatter_piecharts.html
> but with the approach described there I could not reproduce the custom
> marker in the legend.
>
> The approach that did work was to modify the lines.py file in the matplotlib
> folder.
> My version of the file is attached with several new markers added.
>
> The implementation is not very elegant but half-filled markers are quite
> useful when plotting lots of data.
>
> Does anyone have a better idea for the implementation of half-filled markers
> in matplotlib ?

This looks interesting, and the functionality is certainly nice, but
it looks like a brute force hammer approach when a scapel might be
preferable,  For example, what if we introduce a new kwarg fillstyle
with options 'full|top|bottom|left|right' so *any* marker could be
half filled.  This would result in both less code and more
functionality.  If you are interested in tackling this, I'd be happy
to consider a patch.  Please see

  http://matplotlib.sourceforge.net/faq/howto_faq.html#submit-a-patch

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Tkinter problems

2009-07-11 Thread John Hunter
2009/2/23 Gregor Skrt :
>   1.   Where can I find a good tutorial or set of examples for
>      embeding  matplotlib in Tkinter ?
>   2. Problem: I created a simple test with Tkinter. First I plot my
>      graph on __init__ (it works ok). Then I want to clear graph and
>      plot on the same canvas with different parameters. The thing is
>      that plot shows up only when I resize my window. Any idea what
>      could I be doing wrong ? I was trying draw method but it doasn't
>      work...
>

Have you seen the embedding_in_tk*.py examples at

http://matplotlib.sourceforge.net/examples/user_interfaces/index.html

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Add units to plots?

2009-07-11 Thread John Hunter
On Tue, Jul 7, 2009 at 4:06 PM, Joseph Smidt wrote:
> I have several plots where the scientific notation exponential
> overflows to the top of the plot like this:
> http://matplotlib.sourceforge.net/examples/pylab_examples/plotfile_demo.html.
>
> Is there any way to add units to this?  So that, if I wanted, the
> units would show up in the overflow as: 1e8 m^3 , for meters cubed?
>
> Also, is there an easy way to add units to the numbers on the x or y
> axis in general?  Thanks.

You can use a custom formatter, eg::

  from matplotlib.ticker import FormatStrFormatter
  ax.xaxis.set_major_formatter(r'$%.4fm^3'$)  # using mathtext for the
m^3 exponent


See

  
http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.FormatStrFormatter

and some code examples

  http://matplotlib.sourceforge.net/search.html?q=codex+Formatter

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3D Bar (histogram) question

2009-07-11 Thread John Hunter
On Tue, Jul 7, 2009 at 1:26 PM, Nicolas Bigaouette wrote:
> Hi,
>
> I compiled matplotlib svn revision 7246 yesterday to try the 3D stuff.
>
> From mpl's website, an example for 3D bar plotting is shown[1]. I just don't
> understand the axes. From the code, shouldn't X values go from 0 to 20,
> instead of 0 to 400 000 like shown on the graph? Where does these values for
> the X and Z axes comes from (in the graph)?
>
> I'm trying my own 3D bar plot, with similar "weird" results.
>
> Could it be a bug?
>
> Thanx a lot.
>
> [1] http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html

This certainly looks like a bug, and I can replicate it on my end.
Reinier, can you take a look?

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] centering axis ticks labels

2009-07-11 Thread John Hunter
On Thu, Jul 9, 2009 at 9:44 AM, Johann Cohen-Tanugi wrote:
> Hello, how can I center axis tick labels, so that the labels ends up at
> the center between 2 ticks.
>

There is no support for this, though you can left or right align a
label with a single tick::

  for label in ax.xaxis.get_xticklabels():
  label.set_horizontalalignment('right')

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Pluggable Backends

2009-07-11 Thread John Hunter
On Wed, Jul 8, 2009 at 3:49 PM, T J wrote:
> Are matplotlib backends pluggable?  That is, can package X provide an
> experimental backend and tell matplotlib to use it?  If so, how?

Yes, just point to your backend with the syntax:

matplotlibrc::

 backend : module://mybackend  where mybackend is a module in your PYTHONPATH

or in code::

  import matplotlib
  matplotlib.use('module://mybackend')

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] automated labelling in the plot

2009-07-11 Thread John Hunter
On Fri, Jul 10, 2009 at 5:46 AM, Pau wrote:
> Hello,
>
> are there some relative/absolute limits in the plotting area?
>
> I would like to set some text (labels) in the plot automatically, so
> that I do not need to recalculate everytime where they should go.
>
> I mean some kind of absolute X0, Y0, X1, Y1 , so that I know where to
> place the labels in text in the plot area without having to look at
> the particular values of the particular plot I am dealing with, in a
> series of very similar plots.

Specify the coordinates using the axes transform -- (0,0) is bottom
left and (1,1) is top right

  ax = fig.add_subplot(111)
  ax.text(0.1, 0.9, 'this is a test', transform=ax.transAxes)

See also the "annotate" command, which takes a variety of different
coordinate systems: data, axes, figure..

  
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.annotate
  http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo.html
  
http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html


JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Cannot build matplot on OS X: libfreetype.dylib and libiconv.2.dylib are not of the right architecture

2009-07-11 Thread John Hunter
On Thu, Jul 9, 2009 at 4:13 PM, W.P. McNeill wrote:
> I am trying to install matplot on an OS X (10.5.7) Intel MacBook.  I
> cannot build the matplot lib extensions.  I get the following error:
>
> 
> g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk
> -bundle -undefined dynamic_lookup
> build/temp.macosx-10.3-i386-2.5/src/ft2font.o
> build/temp.macosx-10.3-i386-2.5/src/mplutils.o
> build/temp.macosx-10.3-i386-2.5/CXX/cxx_extensions.o
> build/temp.macosx-10.3-i386-2.5/CXX/cxxsupport.o
> build/temp.macosx-10.3-i386-2.5/CXX/IndirectPythonInterface.o
> build/temp.macosx-10.3-i386-2.5/CXX/cxxextensions.o -L/sw/lib
> -L/sw/lib/freetype219/lib -L/usr/local/lib -L/usr/lib -L/sw/lib
> -L/usr/X11R6/lib -lfreetype -lz -lstdc++ -lm -o
> build/lib.macosx-10.3-i386-2.5/matplotlib/ft2font.so
> -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
> ld warning: in /sw/lib/libfreetype.dylib, file is not of required architecture
> ld: in /sw/lib/libiconv.2.dylib, file is not of required architecture
> for architecture ppc
> collect2: ld returned 1 exit status
> lipo: can't open input file:
> /var/folders/xW/xW61KykkHgSaGc2vPwOTCk+++TI/-Tmp-//ccGEBvWb.out (No
> such file or directory)
> error: command 'g++' failed with exit status 1

It looks like there is an incompatibility with the freetype supplied
in /sw (probably fink supplied).  Perhaps it is not configured as a
universal binary.

You can build mpl from svn the way we do when we make a release, which
will automatically fetch and build the dependencies correctly.  First
see,

  http://matplotlib.sourceforge.net/faq/installing_faq.html#which-python-for-osx

then grab a copy of mpl from svn

  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn

and cd into the releases/osx directory and follow the instructions in
the README there.

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Weighted histograms

2009-07-11 Thread John Hunter
On Mon, Jul 6, 2009 at 5:45 PM, Michael Cohen wrote:
> Hi all,
> I am trying to produce a weighted histogram.
> The help text for "hist" here:
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.hist
> has a mention of adding weights, but it is not noted in the command line
> section where this should appear.
>
> Calling:
> hist(data,20,data_weights)
>
> gives the error:
>   File
> "/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/pyplot.py",
> line 1868, in hist
>     ret =  gca().hist(*args, **kwargs)
>   File
> "/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/axes.py",
> line 6236, in hist
>     normed=bool(normed), new=True)
>   File
> "/usr/local/python-2.5.2/lib/python2.5/site-packages/numpy/lib/function_base.py",
> line 353, in histogram
>     mn, mx = range
> ValueError: too many values to unpack
>
> Calling:
> hist(data,20,weights=data_weights)
>
> gives the error:
>   File
> "/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/pyplot.py",
> line 1868, in hist
>     ret =  gca().hist(*args, **kwargs)
>   File
> "/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/axes.py",
> line 6371, in hist
>     p.update(kwargs)
>   File
> "/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/artist.py",
> line 453, in update
>     raise AttributeError('Unknown property %s'%k)
> AttributeError: Unknown property weights
>
> There's no indication in the help text of where or how to insert the
> weights array.


The weights kwarg is not yet in the official release, only in svn.  See

  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn

The site docs and examples generally track svn, so sometimes you see
features that are not out yet.  We will try and get a release out
soon

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib-0.98.5.3.win32-py2.6.exe

2009-07-11 Thread John Hunter
On Mon, Jul 6, 2009 at 9:35 PM, Christoph Gohlke wrote:
> Hi Steve,
>
> matplotlib-0.98.5.3.win32-py2.6.exe was compiled without support for GTK.
>
> If you don't mind trying, I have a build of the matplotlib trunk
> available on my homepage that has GTK support enabled:
>
> http://www.lfd.uci.edu/~gohlke/#pythonlibs
>
> It should work with the PyGTK 2.12 Windows binaries from
> http://www.pygtk.org/downloads.html.
>
> SVG support seems broken: the window.set_icon_from_file() function in
> backend_gtk.py will raise an exception, not recognizing SVG files. The
> PNG icon works.
>

Christoph: could you look into a patch that uses png for the icon for win32/gtk?

Thanks,
JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problems with numpoints in legend

2009-07-11 Thread John Hunter
On Mon, Jul 6, 2009 at 6:06 AM, Oliver Tomic wrote:
> Hi,
>
> Windows XP
> Python 2.5.2
> matplotlib 0.98.5.2
>
> I try to use numpoints for a legend my plot, but without luck. I always end
> up having three points in the legend despite setting numpoints=1 (see below
> towards the end of the code).
> Things work nicely though in a much simpler script.
>
> Help is greatly appreciated.

When posting an example, it helps if we can run it:-)  In this case,
we would need your data files

assC = np.loadtxt('Apples_flowerFlavour_assC_corrPlot.txt')
all = np.loadtxt('Apples_flowerFlavour_allAssessors_corrPlot.txt')

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] half-filled markers

2009-07-11 Thread John Hunter
On Sat, Jul 11, 2009 at 9:55 AM, Eli Brosh wrote:
> Thanks John,
> A kwarg fillstyle with options 'full|top|bottom|left|right' for any marker
> is certainly better than what i have done.
> I just did not have an idea how to program this kwarg.
> Further, I can't see an easy way of generalizing the half-filling of
> markers.
> is there a better way than just programming each half-filled marker
> separately ?
> Perhaps if you can give me some hints, I can try to do the rest of the work.


Sure, first take a look at the coding guide, in particular these two
sections which introduce kwarg processing and documentation
conventions.

  
http://matplotlib.sourceforge.net/devel/coding_guide.html#keyword-argument-processing
  
http://matplotlib.sourceforge.net/devel/coding_guide.html#documentation-and-docstrings

Basically, any new "property", where I use quotes because mpl
properties are not the same as python properties, needs a setter and
getter.  The setter must also have an ACCEPTS flag, which gives the
acceptable arguments.  mpl uses these in the setp and getp
introspection facilities, as well as in the auto-table building of
kwargs in the docs.  The artist.ArtistInspector is used to insepct the
functions and docs to extract the properties:
http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.artist.ArtistInspector



I've committed a patch to svn that implements the fillstyle property
for Line2D, and implemented it for draw_square.  The other filled
markers raise a NotImplementedError if the fillstyle is not 'full',
and that is where you come in.  The basic implementation is to draw
two half markers, one filled and one unfilled, and use the rotation
property of the transformation to support the various
left|right|bottom|top.  Here is the reference implementation for
draw_square::

def _draw_square(self, renderer, gc, path, path_trans):
gc.set_snap(renderer.points_to_pixels(self._markersize) >= 2.0)
side = renderer.points_to_pixels(self._markersize)
transform = Affine2D().translate(-0.5, -0.5).scale(side)
rgbFace = self._get_rgb_face()
fs = self.get_fillstyle()
if fs=='full':
renderer.draw_markers(gc, Path.unit_rectangle(), transform,
  path, path_trans, rgbFace)
else:
# build a bottom filled square out of two rectangles, one
# filled.  Use the rotation to support left, right, bottom
# or top
if fs=='bottom': rotate = 0.
elif fs=='top': rotate = 180.
elif fs=='left': rotate = 270.
else: rotate = 90.

bottom = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 0.5], [0.0,
0.5], [0.0, 0.0]])
top = Path([[0.0, 0.5], [1.0, 0.5], [1.0, 1.0], [0.0,
1.0], [0.0, 0.05]])
transform = transform.rotate_deg(rotate)
renderer.draw_markers(gc, bottom, transform,
  path, path_trans, rgbFace)
renderer.draw_markers(gc, top, transform,
  path, path_trans, None)


See examples/pylab_examples/fillstyle_demo.py in svn, and the attached
patch (although this is already committed, it might be instructional
so you can see the steps needed to add a new property).  When you
finish the others, send along an svn diff and some more examples in
the fillstyle_demo and I'll commit it.

Thanks!
JDH


fillstyle.diff
Description: Binary data
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] centering axis ticks labels

2009-07-11 Thread John Hunter
On Sat, Jul 11, 2009 at 1:15 PM, Eric Firing wrote:
> John Hunter wrote:
>>
>> On Thu, Jul 9, 2009 at 9:44 AM, Johann Cohen-Tanugi
>> wrote:
>>>
>>> Hello, how can I center axis tick labels, so that the labels ends up at
>>> the center between 2 ticks.
>>>
>>
>> There is no support for this, though you can left or right align a
>> label with a single tick::
>>
>>  for label in ax.xaxis.get_xticklabels():
>>      label.set_horizontalalignment('right')
>>
>> JDH
>
> Labels for intervals rather than ticks would be nice to have; this is
> commonly used for labeling months or years, for example.  I don't have time
> to work on it now, unfortunately.
>
> The best way to fake it with present facilities might be to use no labels on
> the major ticks, place minor ticks half-way between the majors, set their
> lengths to zero, and label them.


Nice idea, just committed this example to svn as
examples/pylab_examples/centered_ticklabels.py

import datetime
import numpy as np
import matplotlib
import matplotlib.dates as dates
import matplotlib.ticker as ticker
import matplotlib.pyplot as plt

# load some financial data; apple's stock price
fh = matplotlib.get_example_data('aapl.npy')
r = np.load(fh); fh.close()
r = r[-250:]  # get the last 250 days

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(r.date, r.adj_close)

ax.xaxis.set_major_locator(dates.MonthLocator())
ax.xaxis.set_minor_locator(dates.MonthLocator(bymonthday=15))

ax.xaxis.set_major_formatter(ticker.NullFormatter())
ax.xaxis.set_minor_formatter(dates.DateFormatter('%b'))

for tick in ax.xaxis.get_minor_ticks():
tick.tick1line.set_markersize(0)
tick.tick2line.set_markersize(0)
tick.label1.set_horizontalalignment('center')

imid = len(r)/2
ax.set_xlabel(str(r.date[imid].year))
plt.show()

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib-0.98.5.3.win32-py2.6.exe

2009-07-11 Thread John Hunter
On Sat, Jul 11, 2009 at 6:54 PM, Christoph Gohlke wrote:
>
> Index: lib/matplotlib/backends/backend_gtk.py
> ===
> --- lib/matplotlib/backends/backend_gtk.py      (revision 7257)
> +++ lib/matplotlib/backends/backend_gtk.py      (working copy)
> @@ -1148,7 +1148,7 @@
>  # versions of pygtk, so we have to use a PNG file instead.
>  try:
>
> -    if gtk.pygtk_version < (2, 8, 0):
> +    if gtk.pygtk_version < (2, 8, 0) or sys.platform == 'win32':
>         icon_filename = 'matplotlib.png'
>     else:
>         icon_filename = 'matplotlib.svg'
>

Thanks, committed.  Are there any problems with the toolbar icons on gtk/win32?

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Backend Comparison

2009-07-11 Thread John Hunter
On Sat, Jul 11, 2009 at 7:31 PM, Brian Lewis wrote:
> Does there exist any big-picture comparisons of the provided backends?  For
> example, it would be nice to know what features each backend has or lacks.
> It would also be nice to which backends were generally faster...and which
> were recommended (WX or WXAgg).

There is some detail along these lines at

http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend

but not the feature-by-feature comparison you suggest.  But for WX vs
WXAgg, definitely WXAgg.

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Interactive with the plot, moving marker, etc

2009-07-15 Thread John Hunter
On Tue, Jul 14, 2009 at 12:48 PM, Northenlight wrote:
>
> Hi,
>
> Is there a way to interactive with the plot? For example, draw a vertical
> marker on the plot, let user move the marker and shows x, y values of the
> point where the curve intersect with the marker?


See these examples and tutorial:

http://matplotlib.sourceforge.net/users/event_handling.html
http://matplotlib.sourceforge.net/examples/event_handling/index.html

In particular, the
http://matplotlib.sourceforge.net/examples/event_handling/path_editor.html
example shows how to click and drag points

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting 100's of figures, mpl slows and consumes memory!

2009-07-17 Thread John Hunter
On Fri, Jul 17, 2009 at 7:02 PM, John [H2O] wrote:
>
> I have a script looping through and plotting 100's of figures. It runs fine,
> but after the first few plots, the loop considerably slows down and the
> memory usage keeps going up.
>
> The script is quite complicated, so can't really paste it here, but I am
> trying to pass figure instances around and I am trying to reuse the
> axes/figures... but maybe someone could demonstrate how this is done
> efficiently?

You either need to close the figure in the loop, or reuse the same
figure and cla it, eg

for i in range(1000):
fig = plt.figure()
# plot something
plt.close(fig)


or explicitly reuse the same fig by giving a figure number and clearing it:

for i in range(1000):
fig = plt.figure(1)
# plot something
fig.cla()

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting years and months

2009-07-19 Thread John Hunter
On Sun, Jul 19, 2009 at 7:03 AM, willemmerson wrote:
>
> This is such a noob question but I can't seem to find the answer anywhere. I
> have a certain amount of something per month which I want to display on the
> y axis, I want the x axis to show years and months, i.e. it runs from 2003
> to 2009. I have no problem with the python side, just the plotting side. How
> do I do it?

matplotlib can plot native datetime objects, so if dates is a list of
datetimes, and vals is a list of values, you can:

  ax.plot(dates, vals)

See also these code examples:

  http://matplotlib.sourceforge.net/search.html?q=codex+DateFormatter

and the dates API documentation:

  http://matplotlib.sourceforge.net/api/dates_api.html

JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] possible bug with linestyle='steps'

2009-07-19 Thread John Hunter
On Fri, Jul 17, 2009 at 5:15 PM, Paul Ray wrote:
>
>
> Ryan Krauss-2 wrote:
>>
>> RTFM:
>>
>> plot(t,y, drawstyle='steps-post')
>>
>>
>
> Actually, 'steps-pre' (which is the default) and 'steps-post' seem to have
> swapped definitions.
> Here is what the docs say:
>    *where*: [ 'pre' | 'post' | 'mid'  ]
>      If 'pre', the interval from x[i] to x[i+1] has level y[i]
>      If 'post', that interval has level y[i+1]
>      If 'mid', the jumps in *y* occur half-way between the
>      *x*-values.
>
> In fact both the default behavior and what you get with steps-pre are what
> SHOULD happen with steps-post.  And steps-post (as you point out) does what
> should be the default behavior and that of steps-pre.
>
> I have filed a bug report on this, since it is very important that this work
> as expected.  As the original poster pointed out, this used to work
> correctly but recently seems to have gotten broken.



I am looking first at the behavior of plot with the drawstyle property
set -- let's make sure this is correct before turning to the steps
command, which just uses plot with the drawstyle set -- here is my
test code

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

a = np.array([1,2,3,4,5])

styles = 'default' , 'steps' , 'steps-pre' , 'steps-mid' , 'steps-post'
styles = 'steps' , 'steps-pre'
for ls in styles:
ax.plot(a, ls=ls, label=ls, lw=2)

ax.legend(loc='upper left')

plt.show()


pre causes the step to rise on the x[i], post causes it to rise on
x[i+1] and mid in the middle.  This seems like the correct behavior.
So it does look like the docstring for  'step' is incorrect, and I've
changed it to read


*where*: [ 'pre' | 'post' | 'mid'  ]
  If 'pre', the interval from x[i] to x[i+1] has level y[i+1]

  If 'post', that interval has level y[i]

  If 'mid', the jumps in *y* occur half-way between the


JDH

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with autofmt_xdate()

2009-07-21 Thread John Hunter
On Tue, Jul 21, 2009 at 10:51 AM, Domenico
Nappo wrote:
> "C:\Python25\Lib\site-packages\matplotlib\backends\backend_gtkagg.py", line
> 14, in 
>   from matplotlib.backends._gtkagg import agg_to_gtk_drawable
> ImportError: No module named _gtkagg
>
> I have the suspect that matplotlib windows support simply doesn't exist:)
> I'll try prepackaged windows distributions like EPD or Python(x,y) and hope
> this will solve this issue...


I'm pretty sure they do not package mpl with the gtk backend, but
Christoph Gohlke has a version that does

http://www.lfd.uci.edu/~gohlke/#pythonlibs

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ipython --pylab without namespace pollution?

2009-07-22 Thread John Hunter
On Wed, Jul 22, 2009 at 8:04 PM, Ryan May wrote:
> On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker 
> wrote:
>>
>> Hi folks,
>>
>> Does anyone know if there is a way to use ipython with the advantages of
>> the -pylab option (separate gui thread, etc.), but without the whole
>> pylab namespace getting sucked in?
>
> Put this in your ~/.ipython/ipythonrc:
>
> pylab_import_all 0
>
> That gives you exactly what you want.  In my case, I also made a profile
> that imports numpy as np and matplotlib.pyplot as plt, so that I can get the
> equivalent of the ease pylab without the pollution.

Hey Ryan -- could you write up a sphinx/rest FAQ that describes all
these steps in detail, eg how you create the profile and how you start
ipython, so we can add it to the site docs?  If you are uncomfortable
with the docs, I can apply the patch.

Thanks
JDH

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ipython --pylab without namespace pollution?

2009-07-22 Thread John Hunter
On Wed, Jul 22, 2009 at 8:50 PM, Ryan May wrote:

> I'm willing to.  However, I just noticed that with just the pylab_import_all
> 0, you get the import numpy as np and import matplotlib.pyplot as plt
> automatically. Also, nicely, these don't show up when you type 'whos'.  This
> is with ipython 0.9.1.  Should I just add the pylab_import_all 0 to the FAQ?

Should be enough, but it would be nice to have a little bit on how to
write a profile to add extra imports (eg scipy as sp)  to an ipython
profile and load it in the same FAQ.  Yes, they could find it reading
the ipython docs, but the easier it is to get the info the more useful
it will be.

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] log base 2 plots

2009-07-22 Thread John Hunter
On Tue, Jul 21, 2009 at 3:32 PM, Barnette, Daniel W wrote:
> I've written a python gui to matplotlib which allows the user to plot either 
> cartesian, semi-log, or log-log plots. Log plots can be generated for typical 
> base values except for base 2. Is this a bug, or is there some reason that 
> matplotlib does not do log plots using base 2?

Can you post an example which shows your problem?  The following works for me:

  In [14]: x, y = np.random.rand(2, 100)

  In [15]: loglog(x, y, basex=2)
  Out[15]: []

JDH

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bar charts can't handle datetimes with less than a day between datapoints?

2009-07-22 Thread John Hunter
On Tue, Jul 21, 2009 at 8:00 PM, Nick Seow wrote:
> Hi,
>
> I'm worried that I'm doing something stupid, but can't quite spot it.
>
> testBarCharts() :- X axis in integers. Works fine.
> testBarChartsDTMonths() :- X axis in datetimes, 1 month between data
> points. Works fine
> testBarChartsDTHours() :- X axis in datetimes, 1 hour between data

under the hood, mpl converts datetime objects to days since 1/1/,
using a floating point representation for fractions of a day.  So a
bar width or 1.0 corresponds to 1 day.  The default width to the bar
command is 0.8, which is too thin for months, just right for days, and
too wide for hours.  Eg, for hours do

  bar(x, y, width=0.8*1/24.)  # width is 0.8 hours

for months, do something like

  bar(x, y, width=0.8*30/24.)  # width approx 80% of a month

Perhaps bar should take a width=None arg and try to infer the ideal
with, eg assuming even spacing, but for now you need to specify the
width in fractional days when making bar plots with datetimes.

JDH

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Design questions

2009-07-27 Thread John Hunter
On Mon, Jul 27, 2009 at 10:55 AM, Tony S Yu wrote:
> Below is some code to do 1, 2, and 4.
> The 3rd issue is a bit more difficult. One approach is to use
> Jae-Joon's AxesGrid toolkit; you
> may need to be using the latest development version of matplotlib to use the toolkit.
> BTW, does anyone know why it's ``ax.set_axis_bgcolor`` instead of
> ``ax.set_facecolor``?

very old legacy where the axis background color "bgcolor" predated the
existance of an axes patch with the unified kwargs.  If people want to
deprecate it in favor of

  ax.patch.set_facecolor(color)

I don't object.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Design questions

2009-07-27 Thread John Hunter
On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames wrote:
> Thanks everyone. Everything works perfectly.
> Only a few things left:
>
> How to "trim the canvas" of the image generated? It's transparent, but still
> have a "padding", if it would be cropped, I can safe almost 200px!. I have
> attached a file to this email to show it, the background of the graph was
> set to red only to you see the padding.

use

  fig.subplots_adjust(left=0.05, bottom=0.05, top=0.05, right=0.05)

etc to trim the excess space

> In the file attached to this email, the graph have a space after the
> position 23:00, I wish to remove it.

Several ways to do it: one is:

  ax.autoscale_view(tight=True, scaley=False)

Use

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] on exit event?

2009-07-28 Thread John Hunter
On Mon, Jul 27, 2009 at 4:39 PM, dek wrote:
>
> is there an on exit event for the matplotlib gui, such as when a user clicks
> the 'x' in the gui window

There is not, but it would not be difficult to add.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Radar / Spider Chars

2009-07-28 Thread John Hunter
On Tue, Jul 28, 2009 at 2:27 PM, Tony S Yu wrote:

> I'm always happy to contribute what little I can to matplotlib. However, if
> it's going to be an official example, it should be cleaned up a bit (see
> attached). Summary of changes.

Thanks Tony -- I added this to examples/api/radar_chart.py in svn and
it will show up in the examples and gallery next time I update the
website.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] psd question...

2009-07-29 Thread John Hunter
On Wed, Jul 29, 2009 at 1:39 AM, 3togo wrote:
>
> mlab.psd and pyplot.psd are different


The plotting command pyplot.psd scales the numbers in decibels (the dB
in the ylabel in pyplot.psd).  mlab.psd just returns the unscaled
power.   So in your example in subplot(3,1,3), call before plotting

  x = 10*np.log10(np.absolute(x))


JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] overlaying a plot repeatedly

2009-07-29 Thread John Hunter
On Wed, Jul 29, 2009 at 1:01 AM, Art wrote:
> I have a scatter plot that requires some time to render. The horizontal axis
> is time. Currently, I generate the full scatter plot each time and draw a
> axvline to indicate the progress of time, save the file as a png for each
> time, and generate a movie for all time frames. The scatter plot portion
> doesn't change, just the vertical line.
>
> I was wondering if there was a way to speed this up, to generate the scatter
> plot once and then overlay it with a moving axvline. I would still have to
> save the png frame by frame, but the most expensive step by far is
> replotting the scatter plot over and over.

This is what the animation/blit api is designed to do:

http://www.scipy.org/Cookbook/Matplotlib/Animations

scipy.org appears down right now, so you may need to try again later.
See also these mpl examples:

http://matplotlib.sourceforge.net/search.html?q=codex+blit

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Is there an easy way to change the subplot orders

2009-07-29 Thread John Hunter
On Tue, Jul 28, 2009 at 10:27 PM, Kun Hong wrote:
> Hi,
>
> I am new to matplotlib. Currently I have a need to change the subplot
> orders after the subplts have been added to a figure. I haven't found a
> way to do it easily. One of my solution is to keep an ordered list of
> the subplots and re-add them in the correct order. But this way, all the
> navigation information (zoom/pan) is lost. Another way I found is to
> get the positions (get_position method of Axes) of the subplot and
> then set the positions according to the new order, which is quite
> cumbersom. I am thinking if there is a similar method like add_subplot
> (that is, accepting new positional information of row, column, number
> instead of Bbox), it will be great. Does anyone know any better
> solution?

It should work to call ax.change_geometry on the existing subplot instances.

  
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry

Haven't tested it for this use case, but I'm pretty sure it will do
what you want.  Let me know!

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] overlaying a plot repeatedly

2009-07-29 Thread John Hunter
On Wed, Jul 29, 2009 at 6:50 PM, Art wrote:

> My bottleneck now is actually saving the pngs for mencoder to make into an
> avi (as with the movie_demo example on your site) using savefig. Do you also
> know of an alternative way of generating an avi of the animation? My
> animation has about 9000 frames.

No, I can't imagine there is much fat to trim in that part of the
code.  We're using libpng to write the png, so no speedups there
unless you can make the pngs smaller.  It looks like we are using a
memory pointer to get the rgba data from agg over to png, so no
speedups there either.  Perhaps Michael has some input.  Some code
that we could run and test might help produce some further
optimizations.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and no gui

2009-07-29 Thread John Hunter
On Wed, Jul 29, 2009 at 7:33 PM, Christian Lerrahn wrote:
> Hi,
> I'm trying to make a few matplotlib scripts work on a box without any
> X. However, I would like to change it as little as possible and
> therefore don't want to get rid of the pylab interface.
>
> I almost got it to work already by just using the "dummy GUI", i.e. i
> use
>
> import matplotlib as m
> m.use('Template')
> import pylab as p

Why not::

  import matplotlib
  matplotlib.use('Agg')

Then you have a full featured mpl backend w/ no GUI or X requirements.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Building current SVN trunk on Mac OS X 10.5

2009-07-29 Thread John Hunter
On Wed, Jul 29, 2009 at 4:34 PM, Uri Laserson wrote:
> Hi everyone,
>
> I am trying to build the latest svn trunk version of MPL on OS X 10.5.  I am
> getting the following error:

Try

  make build_osx105
  python setup.py install --prefix=~/somewhere

If that doesn't work, try

  cd release/osx

read the readme there and follow the instructions.  This will build
mpl the way we do when making a release: fetch the dependencies (zlip,
png and freetype) and build them with the right flags, and then build
mpl explcitly linking to these libs.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animation/"live"-plotting + performance

2009-07-29 Thread John Hunter
On Wed, Jul 29, 2009 at 1:25 PM, Antonino Ingargiola wrote:

> I have attached another example of blit animation that does NOT
> require the svn version of MPL.

How did this help with your performance problems?  The animation/blit
paradigm is great for *some* use cases, eg animating a cross-hair over
a static background, but is not ideal for strip charts, where the data
marches uniformly off the left of the figure.  The problem is, in the
strip chart case, most of the figure is simply shifted left, and only
the new part needs to be redrawn.  This does not map naturally to the
blit paradigm as mpl expresses it, since so many artists need to be
updated, eg all the tick labels, the line, the ticks.

I think we need some custom data structures, like numpy objects that
look like arrays but are circular buffers, so we can push stuff onto
the end, have it drop off the front, but is transparent to naive users
like mpl (or we could use the mpl units interface to support these
objects with some custom method calls to get an "unwrapped" view of
the data) and an API for shifting big chunks of the rendered axes to
the left, drawing just the right part of the updated circular buffers,
and making sure the stitching together at the seams looks good.

Roland: if you are inclined to "roll your own" plotting library as you
suggested in your OP, I encourage you to look into adding this support
to mpl or working on a toolkit, because such functionality is sorely
needed and I would encourage all developers to help out in improving
the core to support this effort.

You may also want to look at chaco, which generally far outperforms
mpl for quasi real-time interactive plotting stuff.  I am not sure if
they explicitly have support for strip charting, but would not be
surprised if they did.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and no gui

2009-07-29 Thread John Hunter
On Wed, Jul 29, 2009 at 9:05 PM, Christian Lerrahn wrote:

>> Why not::
>>
>>   import matplotlib
>>   matplotlib.use('Agg')
>>
>> Then you have a full featured mpl backend w/ no GUI or X requirements.
>
> Thanks for that! I had overlooked that backend. It seems to do the
> trick perfectly. :)


Great -- take a look at

  http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

which will explain the situation in much more detail.  Also, the FAQ

  
http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server

is useful even if you are not writing a webapp server, since the
issues of working in a non-X environment are similar to your case.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib-0.99.0-rc1 : call for testing

2009-07-31 Thread John Hunter
We have a test release candidate rc1 of the impending
matplotlib-0.99.0 release, including lots of great new stuff like the
axes grid and mplot3d toolkits,

  http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/index.html
  http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html

We have uploaded tarballs, eggs and binary installers for win32 and
OSX, and would love to have some testers.  You can grab the release
candidates from:

  http://drop.io/xortel1#

If you have any bugfixes or patches, feel free to post them here, but
please also post to the tracker

  https://sourceforge.net/tracker/?group_id=80706&atid=560720

Thanks to Michael Droettboom with help setting up the release branch,
Christoph Gohlke for the python2.6 win32 binaries, and William Stein
for providing a remote OSX box for building and testing OSX binaries.

Those of you with svn access can grab the release branch from::

  svn co https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint
mpl99

and post patches against svn for any bugs you discover and fix::

  http://matplotlib.sourceforge.net/faq/howto_faq.html#submit-a-patch

Thanks to all the developers who contributed in this cycle -- more
details to follow on the official release announcement next week.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] executing function when view interval changes

2009-08-01 Thread John Hunter
On Sat, Aug 1, 2009 at 7:32 PM, Alan G Isaac wrote:
> On 8/1/2009 4:07 PM Thomas Robitaille apparently wrote:
>> Since matplotlib is about to hit 0.99,
>
>
> Which reminds me, was there a decision on subplot2grid etc?
> http://sourceforge.net/mailarchive/message.php?msg_name=6e8d907b0905172009j21b5077fp242c7598ee9fb2c9%40mail.gmail.com>

There are lots of good suggestions in that thread -- on this issue,
all the best people will be at scipy and/or participating in the
sprint (Andrew who wrote the mpl sizer toolkit, JJ who does more
strange and wonderful things than anyone, Ryan May who has thought
through the issues and has done a lot of great work).  So we'll
definitely bring it up and see if we can do something about it.  There
are two pieces to this thread: the non-pythonic 1 based addressing of
the current subplot command ("don't blame me, talk to the mathworks"),
and the ability to easily specify column or row spans across the grid.
 The former is a minor wart that is unlikely to change, the latter is
a significant feature that we should definitely support. Maybe you can
join us via skype if not in person in  Pasadena, and we can try an
improve the current implementation.  I don't imagine adding support
for spans would be too hard,

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] spines versus subplotzero

2009-08-02 Thread John Hunter
On Sun, Aug 2, 2009 at 2:14 AM,  wrote:
> I'm trying to understand some of the changes in 0.99, for example, the
> recommended way of getting a plot so that the axes cross at the origin
> (i.e., the axes are in the middle of the plot).  I see two examples that
> seem to give this:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html
>
> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html
>
> Is one or the other of these methods the recommended way to get a plot
> with axes in the middle that cross at the origin?  Or are they both good
> and apply to different situations?

I'll let Andrew and JJ fill in some color, since they wrote the spine
and axes_grid, respectively, but both are good.  The spines are in the
mainline and JJ's solution is in a toolkit, so when in doubt go with
something in the mainline since that is more likely to be stable.
Both JJ and Andrew will be attending the scipy sprint this year (if
you're going to be there be sure to stop by), and one of the items on
our agenda is to incorporate their work into a unified API in the
mainline.  So there may be some changes to one or both approaches, but
hopefully soon we will have most of the feature set of both in our
main axis code.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Backend neutral idle event won't repeat

2009-08-02 Thread John Hunter
On Sat, Aug 1, 2009 at 12:05 PM, Mark Rubelmann wrote:
> Hi,
>
> I'm writing a script to plot data being read from a serial connection in
> real time.  I'm trying to use an idle_event callback to continually read the
> incoming data and plot it.  The problem is that the callback is only getting
> invoked once.  I found this page:
> http://www.scipy.org/Cookbook/Matplotlib/Animations, which suggests using
> backend-specific stuff.  This is intended to be a quick-and-dirty thing
> though so I was really hoping to avoid that.  Here's my code:

Wriing a GUI neutal idle event handler is not easy -- I've spent some
time on it but crashed and burned on tk -- but my guess is that the
problem you are having in your code is that GTK expects you to return
True is you want the func to be called again.  As soon as you return
False the event handler is terminated.  You return nothing, which is
None, which is False.  A simple "return True" may cure what ails you
vis-a-vis gtk.  But pylab animation is not supported, so I suggest
that you code to your GUI of choice for animation until we get a
proper GUI neutral animation event API.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Backend neutral idle event won't repeat

2009-08-02 Thread John Hunter
On Sun, Aug 2, 2009 at 8:08 AM, John Hunter wrote:

> Wriing a GUI neutal idle event handler is not easy -- I've spent some
> time on it but crashed and burned on tk -- but my guess is that the
> problem you are having in your code is that GTK expects you to return
> True is you want the func to be called again.  As soon as you return
> False the event handler is terminated.  You return nothing, which is
> None, which is False.  A simple "return True" may cure what ails you
> vis-a-vis gtk.  But pylab animation is not supported, so I suggest
> that you code to your GUI of choice for animation until we get a
> proper GUI neutral animation event API.

I should phrase this last bit differently: I would like to support
this, and spent a fair amount of time trying to get this working
properly across backends.  I think it *does* work on GTK and WX.  I
encountered some problems in tkagg: since tk does not have a native
idle event loop that I could wrap, I tried to use python threading to
implement it, and ran into problems with cross thread signal handling
(including losing CTRL-C and some strange on-exit behavior) so
commented out the code, and have not attempted qt or macosx.  I think
it would be great if we could abstract the idle handler and timeout
handler across the GUIs so that mpl animation would be easier, but to
date this has eluded me.  So in the meantime, I would stick to the API
of the GUI of your choice until we can get proper support for this as
an mpl event.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] show figures in a loop

2009-08-02 Thread John Hunter
On Sun, Aug 2, 2009 at 8:14 AM, Janwillem wrote:
>
> The problem:
> I have files with time versus signal data of a large series of measurements.
> The python application (using wxPython actually) scans the file, applies
> some math (numpy/scipy) on each record of data and than must show the signal
> as a plot. After clicking OK the next record of measurement data is
> processed and  shown. So I do need some construct that allows showing a
> series of figure one after the other. My solution works ok but I would think
> that there should be an elegant shortcut that directly scales the
> mathplotlib figure to a bitmap that can be shown.
> Does that better explain the purpose of my question?

You are probably doing the best thing using wx for the event handling
in this app, but you do not need to save to png.  You can get access
to the rendered figure in code as either a python buffer or string,
using one of several *Agg backend methods, eg buffer_rgba,
tostring_rgb, tostring_argb.  See for example

  
http://matplotlib.sourceforge.net/examples/pylab_examples/agg_buffer_to_array.html

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Backend neutral idle event won't repeat

2009-08-02 Thread John Hunter
On Sun, Aug 2, 2009 at 10:35 AM, John Hunter wrote:
> On Sun, Aug 2, 2009 at 9:39 AM, Mark Rubelmann wrote:
>> Thanks for the reply John.  Not quite the answer I was looking for
>> though ;)  I tried your suggestion of returning True but it didn't solve
>> the problem.  Oh well, not the end of the world.  Being a die-hard KDE user,
>> I started trying to get things working with Qt.  I got my animation working
>> but thus far haven't been able to catch key press events.  My guess is that
>> I'm just missing something about how it's supposed to be done so I'll
>> probably figure it out.
>
> You should be able to use mpl key press events even while embedding in qt

oops posted in the wrong thing from my buffer.  Meant to post this link

http://matplotlib.sourceforge.net/search.html?q=codex+key_press_event

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Backend neutral idle event won't repeat

2009-08-02 Thread John Hunter
On Sun, Aug 2, 2009 at 9:39 AM, Mark Rubelmann wrote:
> Thanks for the reply John.  Not quite the answer I was looking for
> though ;)  I tried your suggestion of returning True but it didn't solve
> the problem.  Oh well, not the end of the world.  Being a die-hard KDE user,
> I started trying to get things working with Qt.  I got my animation working
> but thus far haven't been able to catch key press events.  My guess is that
> I'm just missing something about how it's supposed to be done so I'll
> probably figure it out.

You should be able to use mpl key press events even while embedding in qt

/Users/jdhunter/Library/Preferences/Aquamacs Emacs/customizations.el

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Include icon in plot

2009-08-02 Thread John Hunter
On Sun, Aug 2, 2009 at 1:28 PM, Jae-Joon Lee wrote:
> A snippet of code does not help in general.
> Please take your time to create a simple, standalone code that
> reproduces your problem and post that code in this mailing list so
> that we can easily test.
>
> Here is the code, based on yours, that works for me.

The other approach is to use a figimage and use the ax.transData
instance to convert data coords to fig coords for the offsets.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Include icon in plot

2009-08-03 Thread John Hunter
On Mon, Aug 3, 2009 at 6:55 AM, Bas van Leeuwen wrote:

> PS, @John, I'd like to try the imshow approach first because it is not
> in a figure but in a QT frame containing several subplots. But thank
> youfor the suggestion, I will try if the imshow approach appears
> fruitless.

All matplotlib axes and subplots live in figures, you just may not
know it.  The call to gca in your code below:

  >>ax = gca()
  >>limx = ax.get_xlim()

automatically creates a figure and adds the axes to is.  So you can
still access the figure, eg

  fig = ax.figure

You can then call figimage

  # transform from axes coorrs (x,y) -> display coords (xo,yo)
  xo, yo = ax.transData.transform_point((x,y))
  fig.figimage(Z, xo, yo)

where Z is your image array

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] A couple of new gallery examples?

2009-08-03 Thread John Hunter
On Mon, Aug 3, 2009 at 11:37 AM, Josh Hemann wrote:
>
> I am submitting two possible gallery additions for bar charts and boxplots.
> The existing examples are good, but being relatively new to matplotlib I had
> to learn quite a bit to enhance these charts to fit my needs. Learning is
> good of course, but maybe these "more complete" examples will help others to
> get up to speed more quickly. Likewise, I am sure there are experts out
> there who can comment on better, more Pythonic ways of doing things, so
> please feel free to offer advice.
>
>
>
>
> http://www.nabble.com/file/p24793965/barchartdemo.png
>
>
> http://www.nabble.com/file/p24793965/boxplotdemo.png


Great I added these to the release branch.  Please attach examples
going forward, since the browser wrapped a lot of code that I had to
clean up.  Also, there was one (if x else y) usage that is not
supported in python2.4, which we still support, so I rewrote that.
Finally, I had some trouble with the get_xdata().data call,

jo...@udesktop191:mpl99> python examples/pylab_examples/boxplot_demo2.py
Traceback (most recent call last):
  File "examples/pylab_examples/boxplot_demo2.py", line 85, in ?
plt.plot([np.average(med.get_xdata().data)], [np.average(data[i])],
  File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/lib/function_base.py",
line 616, in average
avg = a.mean(axis)
TypeError: unsupported operand type(s) for /: 'buffer' and 'float'

but just replacing that with get_xdata() seemed to work fine.
Attached are the cleaned up examples I committed


barchart_demo2.py
Description: Binary data


boxplot_demo2.py
Description: Binary data
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Windows 64 bit support for matplotlib?

2009-08-03 Thread John Hunter
On Mon, Aug 3, 2009 at 2:24 PM, Clem Wang wrote:

> However, that is not true because Python 2.6 (64 bit) is in fact installed.
>
> I believe the actual problem is due to the fact I'm trying to install the 32
> bit library and there is no 64 bit library version of matplotlib.

Could you please test our 0.99 release candidate, for which there is a
64bit win32 python2.6 installer:

  http://drop.io/xortel1#

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Resolution of eps files

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 4:22 AM, Maxim Khazimullin wrote:

> Is it normal for eps files (when files with different dpi have the same
> sizes), or something wrong with matplotlib?


PS is a vector drawing backend, so the concept of "dots per inch" does
not apply, unless you are explictly including a raster image int he
output.  So it is a feature, not a bug :-).  More detail on raster vs
vector backends here:

  http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 3:52 AM, Johann Rohwer wrote:
> Using the latest SVN matplotlib, the TkAgg backed does not get built
> even though all the libraries are installed (Linux 64-bit). The
> following error message occurs during the build:
>
> Tkinter: no
>         * Using default library and include directories for
>         * Tcl and Tk because a Tk window failed to open.
>         * You may need to define DISPLAY for Tk to work so
>         * that setup can determine where your libraries are
>         * located. Tkinter present, but header files are not
>         * found. You may need to install development
>         * packages.


The message suggests you may not have access to the windowing system,
and the build process needs it to import tk.  Are you building on a
remote box, or as root who may not have access to your user desktop?
If so, you can solve these problems by ssh with -X or otherwise make
sure that you can launch an X window in your build environment.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 3:52 AM, Johann Rohwer wrote:
> Using the latest SVN matplotlib, the TkAgg backed does not get built
> even though all the libraries are installed (Linux 64-bit). The
> following error message occurs during the build:
>
> Tkinter: no
>         * Using default library and include directories for
>         * Tcl and Tk because a Tk window failed to open.
>         * You may need to define DISPLAY for Tk to work so
>         * that setup can determine where your libraries are
>         * located. Tkinter present, but header files are not
>         * found. You may need to install development
>         * packages.


The message suggests you may not have access to the windowing system,
and the build process needs it to import tk.  Are you building on a
remote box, or as root who may not have access to your user desktop?
If so, you can solve these problems by ssh with -X or otherwise make
sure that you can launch an X window in your build environment.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Some questions about text

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 8:16 AM, Pim
Schellart wrote:

> 1. option to force display of the full number on each tick (with the
> option to display the numbers at an angle to prevent overlapping).

This is controlled by the "set_scientific" method of the ScalarFormatter

  
http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.ScalarFormatter

For example::

In [101]: ax = gca()

In [102]: ax.plot(np.arange(10)*2e20)
Out[102]: []

In [103]: draw()

In [104]: formatter = ax.yaxis.get_major_formatter()

In [105]: formatter.set_scientific(False)

In [106]: draw()

> 2. option to specify the number to be subtracted manually (to make it
> a round number).

I don't think there is support for this, but it would be a nice feature::

  http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto

> 3. option to specify the precision or scientific notation of both the
> ticks and the number to be added.

You can control at what level the fallover to scientific notation
occurs with the set_power_limits method of the formatter::

  
http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.ScalarFormatter.set_powerlimits

This is also exposed as an rc param::

   axes.formatter.limits : -7, 7 # use scientific notation if log10
  # of the axis range is
smaller than the
  # first or larger than the second

See http://matplotlib.sourceforge.net/users/customizing.html

Hope this helps!
JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 9:14 AM, Johann Rohwer wrote:

> Type "help", "copyright", "credits" or "license" for more information.
 import Tkinter
 a=Tkinter.tkinter.create()
>
> which creates a tk window on my desktop.
>
> So really in the dark what's going on here

Very odd.  I suggest opening up setupext.py and finding the function
"check_for_tk".  There are a series of test which ultimately set the
"gotit" variable to determine whether you have tk for building.
Insert a lot of debug print statements throughout the logic of that
function and find out where it is failing and let us know.

My guess is you will fail in  the "explanation = add_tk_flags(module)"
part of the code, so you may need to dive into there and repeat the
exercise to figure out what is failing and why.  If you can repeat the
steps that the build process is attempting in your python shell, you
may be able to hone into the point of failure

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread John Hunter
On Mon, Aug 3, 2009 at 11:38 PM, Gökhan Sever wrote:
> Hello,
>
> I was wondering if it is possible to hide some data on figures using a say
> right click option to any of the legend entry and make it temporarily
> hidden/visible to better analyse the rest of the data?
>
> Check this screenshot for example:
>
> http://img25.imageshack.us/img25/9427/datahiding.png
>
> The red data clutters the rest of the figure, and I would like to be able to
> hide it temporarily so that I can investigate the other two relations more
> easily.
>
> Any ideas? or alternative solutions?

It's a nice idea, and should be doable with the pick interface we have
for all mpl artists.  Unfortunately, there were a few problems in the
legend implementation which blocked the pick events from hitting the
proxy lines they contained.  I just made a few changes to mpl svn HEAD
to support this, and added a new example.

  examples/event_handling/legend_picking.py

which I'll include below.   JJ could you review the changes to legend.py?

Instructions for checking out svn are at::

  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn

Here is the example:

"""
Enable picking on the legend to toggle the legended line on and off
"""
import numpy as np
import matplotlib.pyplot as plt

t = np.arange(0.0, 0.2, 0.1)
y1 = 2*np.sin(2*np.pi*t)
y2 = 4*np.sin(2*np.pi*2*t)

fig = plt.figure()
ax = fig.add_subplot(111)

line1, = ax.plot(t, y1, lw=2, color='red', label='1 hz')
line2, = ax.plot(t, y2, lw=2, color='blue', label='2 hz')

leg = ax.legend(loc='upper left', fancybox=True, shadow=True)
leg.get_frame().set_alpha(0.4)


lines = [line1, line2]
lined = dict()
for legline, realine in zip(leg.get_lines(), lines):
legline.set_picker(5)  # 5 pts tolerance
lined[legline] = realine

def onpick(event):
legline = event.artist
realline = lined[legline]
vis = realline.get_visible()
realline.set_visible(not vis)
fig.canvas.draw()

fig.canvas.mpl_connect('pick_event', onpick)

plt.show()

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib-0.99.0-rc1 : call for testing

2009-08-05 Thread John Hunter
On Wed, Aug 5, 2009 at 5:55 AM, Michiel de Hoon wrote:
>
> I am seeing the following error with the GTKCairo and GTKAgg backends:
>
 figure()
> 
 Traceback (most recent call last):
>  File 
> "/usr/local/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py", 
> line 249, in enter_notify_event
>    FigureCanvasBase.enter_notify_event(self, event, guiEvent=event)
> TypeError: enter_notify_event() got multiple values for keyword argument 
> 'guiEvent'
> Traceback (most recent call last):
>  File 
> "/usr/local/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py", 
> line 246, in leave_notify_event
>    FigureCanvasBase.leave_notify_event(self, event, guiEvent=event)
> TypeError: leave_notify_event() got multiple values for keyword argument 
> 'guiEvent'
>
> whenever I move the mouse into or out of the figure windows.

Good catch -- in fixing a sf bug in which the GTK gui event was not
getting attached to the scroll event

  
https://sourceforge.net/tracker/?func=detail&aid=2816580&group_id=80706&atid=560720

I noticed most other events were not getting their gui event attached,
and apparently went overboard and added them to the enter/leave events
when they were already there.  Fixed in the svn branch and will be
merged into the trunk later -- thanks for catching it

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and QT 4.5.2

2009-08-05 Thread John Hunter
2009/8/5 Michael Droettboom :
> I don't think this is related to Qt at all, but is illustrating some
> sort of bug in the font lookup code.
>
> Can you try removing fontList.cache and trying again?  I *believe* it
> lives in "C:\Documents and Settings\${YOURNAME}\Local
> Settings\.matplotlib" on Windows, but I'm not a regular Windows user.
> You may have to search for it.

Running any pylab script with --verbose-helpful should report the font
cache location; see the line starting with "Using fontManager instance
from "

jo...@udesktop191:pylab_examples> python simple_plot.py --verbose-helpful

$HOME=/home/titan/johnh
CONFIGDIR=/home/titan/johnh/.matplotlib
matplotlib data path
/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/mpl-data
loaded rc file /home/titan/johnh/.matplotlib/matplotlibrc
matplotlib version 0.99.0.rc1
verbose.level helpful
interactive is False
units is False
platform is sunos5
Using fontManager instance from /home/titan/johnh/.matplotlib/fontList.cache
backend TkAgg version 8.4
findfont: Matching
:family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
to Bitstream Vera Sans
(/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
with score of 0.00
findfont: Matching
:family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=large
to Bitstream Vera Sans
(/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
with score of 0.00

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Re peated calls to Specgram for animation, memory leaking

2009-08-05 Thread John Hunter
On Wed, Aug 5, 2009 at 8:08 AM, Michael Droettboom wrote:
> Images added to an axes get added to the axes' "images" member, so you can
> simply remove it from there.

It may be more efficient to call im.set_array(newdata) rather than
creating a new image each time.  Eg

http://matplotlib.sourceforge.net/examples/animation/dynamic_image_gtkagg.html

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hexbin density plots in matplotlib?

2009-08-05 Thread John Hunter
On Wed, Aug 5, 2009 at 10:25 AM, Ryan May wrote:

>> is there a way to do this in matplotlib? thanks for your help.
>
> Not to be rude, but is there any reason you didn't look for pyplot.hexbin
> before sending the email? :)

Continuing in the non-rude vein :-) See these examples::

  http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo.html
  http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo2.html

and this doc string::

  http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.hexbin

Have fun!
JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting lines with shaded / transparent region for standard deviation

2009-08-05 Thread John Hunter
On Wed, Aug 5, 2009 at 9:40 AM, per freem wrote:
> hi all,
>
> is there a way in matplotlib to plot lines with errorbars, e.g. using
> errorbar(...) but instead of lines just have shaded, partly transparent
> regions that represent the error bars? people often use this to show
> confidence intervals or error bars... an example is here:
>
> http://eva.nersc.no/vhost/arctic-roos.org/doc/observations/images/ssmi1_ice_ext.png
>
> where the black line has shaded grey bands around. i'd like to plot
> something like this but have the band be partly transparent.

I use fill_between for this -- draw the line with "plot" and the
shaded region with "fill_between".  You can specify the alpha on the
fill_between call:

  
http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between_demo.html
  
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.fill_between

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ANN: matplotlib 0.99.0

2009-08-06 Thread John Hunter
The 0.99.0 release of matplotlib is available for download.  Lots of
great new features and tons of bug fixes.  Thanks to all the mpl
developers for their contributions, and to Christoph Gohlke for the
win32 builds, Russell Owen for the OSX testing and bug reports,
William Stein for hosting the OSX build box, and Michael
Droettboom for the release branch support

  Download: https://sourceforge.net/projects/matplotlib
  What's new: http://matplotlib.sourceforge.net/users/whats_new.html

OSX users may want to consult

  http://matplotlib.sourceforge.net/faq/installing_faq.html#os-x-questions

Here are the highlights:

* mplot3d : Reinier Heeres has ported John Porter's mplot3d over to
  the new matplotlib transformations framework, and it is now
  available as a toolkit mpl_toolkits.mplot3d

example:  
http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo.html
tutorial: 
http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html

* axes grid toolkit : Jae-Joon Lee has added a new toolkit to ease
  displaying multiple images in matplotlib, as well as some support
  for curvilinear grids to support the world coordinate system

example 1: 
http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html
example 2: 
http://matplotlib.sourceforge.net/examples/axes_grid/simple_rgb.html
tutorial : 
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/index.html

* axes spines: Andrew Straw has implemented the much awaited support
  for spines.  No longer are your axis lines constrained to be a
  simple rectangle around the figure -- you can turn on or off left,
  bottom, right and top, as well as "detach" the spine to offset it
  away from the data.

example: 
http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html

* new documentation: Jae Joon has written a guide to legends and annotations:


http://matplotlib.sourceforge.net/users/plotting/legend.html#plotting-guide-legend


http://matplotlib.sourceforge.net/users/plotting/annotation.html#plotting-guide-annotation

* Lots of small bug features and bug fixes -- here from the CHANGELOG::

2009-08-06 Tagging the 0.99.0 release at svn r7397 - JDH

   * fixed an alpha colormapping bug posted on sf 2832575

   * fix typo in axes_divider.py. use nanmin, nanmax in
angle_helper.py
 (patch by Christoph Gohlke)

   * remove dup gui event in enter/leave events in gtk

   * lots of fixes for os x binaries (Thanks Russell Owen)

   * attach gtk events to mpl events -- fixes sf bug 2816580

   * applied sf patch 2815064 (middle button events for wx) and
 patch  2818092 (resize events for wx)

   * fixed boilerplate.py so it doesn't break the ReST docs.

   * removed a couple of cases of mlab.load

   * fixed rec2csv win32 file handle bug from sf patch 2831018

   * added two examples from Josh Hemann:
examples/pylab_examples/barchart_demo2.py
 and examples/pylab_examples/boxplot_demo2.py

   * handled sf bugs 2831556 and 2830525; better bar error
messages and
 backend driver configs

   * added miktex win32 patch from sf patch 2820194

   * apply sf patches 2830233 and 2823885 for osx setup
and 64 bit;  thanks Michiel

2009-08-03 Fixed boilerplate.py so it doesn't break the ReST docs. - JKS

2009-08-03 pylab no longer provides a load and save function.  These
   are available in matplotlib.mlab, or you can use
   numpy.loadtxt and numpy.savetxt for text files, or np.save
   and np.load for binary numpy arrays. - JDH

2009-07-31 Tagging 0.99.0.rc1 at 7314 - MGD

2009-07-30 Add set_cmap and register_cmap, and improve get_cmap,
   to provide convenient handling of user-generated
   colormaps. Reorganized _cm and cm modules. - EF

2009-07-28 Quiver speed improved, thanks to tip by Ray Speth. -EF

2009-07-27 Simplify argument handling code for plot method. -EF

2009-07-25 Allow "plot(1, 2, 'r*')" to work. - EF

2009-07-22 Added an 'interp' keyword to griddata so the faster linear
   interpolation method can be chosen.  Default is 'nn', so
   default behavior (using natural neighbor method) is
unchanged (JSW)

2009-07-22 Improved boilerplate.py so that it generates the correct
   signatures for pyplot functions. - JKS

2009-07-19 Fixed the docstring of Axes.step to reflect the correct
   meaning of the kwargs "pre" and "post" - See SF bug
   
https://sourceforge.net/tracker/index.php?func=detail&aid=2823304&group_id=80706&atid=560720
   - JDH

2009-07-18 Fix support for hatches without color fills to pdf and svg
   backends. Add an example of that to hatch_demo.py. - JKS


Re: [Matplotlib-users] No legend using scatter function

2009-08-06 Thread John Hunter
On Thu, Aug 6, 2009 at 11:47 AM, Jae-Joon Lee wrote:
> This turned out to be a bug introduced recently, which is now fixed in
> the 0.99 maintenance branch.
> The fix is not merged into the head yet. I tried svnmerge.py but it
> gave some merge conflict. While the conflict seems rather trivial,
> I'll leave it to others.

I've merged and resolved these conflicts, so HEAD should be good now.

Too bad the fix squaeked in minutes after the release -- it will have
to wait for the bugfix release, which hopefully will not be too soon,
since we did a fair amount of rc testing this time around.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Wrong download link for MPL 0.99?

2009-08-06 Thread John Hunter
On Thu, Aug 6, 2009 at 6:30 PM, Zane Selvans wrote:
> For some reason the download link on the Matplotlib pages is pointing to
> Basemap 0.99.4 instead of Matplotlib 0.99.0.

Jeff, I don't know if this is a limitation in the new sf file manager
interface or what, but it appears only 1 file project-wide can be the
"default download" for any given OS.  On the mpl side, I already had
to choose between the 2.5 and 2.6 binary installer for a given
platform (deferring to 2.6), and it looks like your platform
selections for basemap are overriding the mpl base packages.  I
removed the default OS setting from the basemap packages, so that mpl
would appear as the default "download" choice for those visiting the
project page.  The basemap toolkit pages may want to include a special
install/download section that links to the right files.

Or if I am screwing something up bis-a-vis the sf software, let me
know.  It looks like we may be encountering early warts in their new
admin interface.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with Matplotlib on Win32 and "ImportError: DLL load failed"

2009-08-07 Thread John Hunter
On Thu, Aug 6, 2009 at 8:48 PM, Patrick Rynhart wrote:
> Dear all,
>
> We are using Python 2.5, matplotlib and NumPy on Windows to assist
> with the teaching for an undergraduate paper.  On a small number of
> installations, an error attempting to load some required DLL's is
> being reported (on approx 3 machines out of approximately 60).  There
> doesn't appear to be any pattern with this - we can seen it on one
> install of Windows Server 2008 and also on various versions of Windows
> XP (Professional and Home).
>
> Symptoms are, after a "from pylab import *", the following traceback:
>
> Traceback (most recent call last):
>  File "C:\Documents and
> Settings\Jo\workspace\test\src\root\nested\__init__.py", line 2, in
> 
>    from pylab import *
>  File "C:\Python25\Lib\site-packages\pylab.py", line 1, in 
>    from matplotlib.pylab import *
>  File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 206,
> in 
>    from matplotlib import mpl  # pulls in most modules
>  File "C:\Python25\Lib\site-packages\matplotlib\mpl.py", line 1, in 
>    from matplotlib import artist
>  File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 4, in 
> 
>    from transforms import Bbox, IdentityTransform, TransformedBbox,
> TransformedPath
>  File "C:\Python25\Lib\site-packages\matplotlib\transforms.py", line
> 34, in 
>    from matplotlib._path import affine_transform
> ImportError: DLL load failed: The specified module could not be found.

We have seen this problem several times  before, and have labored hard
to banish it, but it always has a way of coming back to haunt us.  I
am aware of a bug in python2.6 which causes mingw to build broken
win32 binaries, but am not aware of such  a problem w/ python2.5,
which you appear to be using.  We often use a program called
dependency walker to track these problems down:

  http://www.dependencywalker.com/

Open the problematic file (it should be
C:\Python25\Lib\site-packages\matplotlib\_path.pyd) and report any
errors you find here; it should tell you which DLLs are missing.
Search the good and the bad boxes for these DLL filenames and see if
it is a difference in the boxes, eg do the good boxes have the DLL and
the bad boxes not, and if so maybe you can figure out why (different
version in the OS patch level?).  I am really interested to know the
difference in the boxes because it may give us the critical clue as to
why some users report this problem and others do not see it.

Also, on one of the bad boxes, could you try the new 0.99 release and
let me know if you have the same issue?

I build the python2.5 installers with mingw; Christoph builds the
python2.6 installers with Visual Studio precisely because mingw is
broken on python2.6.  If we can't banish this bug on 2.5 w/ mingw, I
may have to lean on his generosity and ask him to make a python2.5
installer with Visual Studio as well.

JDH

PS: rereading your email, I see you are using 0.98.3.  The first time
I read it, when I wrote the response above, I thought you were using
0.98.5.3 -- the .3 at the end tricked me.  The latter is fairly
recent, and came out 10 months after 0.98.3, and we did several things
to fix exactly this dll problem in interim.  At a minimum, you need to
be testing and installing 0.98.5.3.  This is a very stable, bug fix
release, suitable for use in the classroom.  I can't guarantee you
won't hit the same problem, but at least you will be using a version
that *shouldn't* have it, though I am still interested in the results
of the dependency walker tests above, because I have wasted so much
time trying to fix these win32 installers.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib, build from source on osx 10.5.8

2009-08-07 Thread John Hunter
On Thu, Aug 6, 2009 at 9:28 PM, sasha wrote:
>
> Hi All,
>
> i'm tring to install matplotlib (svn) on a fesh mac osc installation
> using the system python 2.5.1.
>
> but i have problems with freetype :-/

No, you have troubles with libpng -- check the first instance of
"error" in your gcc output:

  src/backend_agg.cpp:3:17: error: png.h: No such file or directory

Either you do not have libpng installed, or it is in a place where the
build cannot find it.  Try installing it in a place where the build
can find it.  Take a look at release/osx/Makefile to see the configure
flags and environment variables we set when building png for the OSX
installer.  In particular, we use

  CFLAGS="-Os -arch ppc -arch i386"
  LDFLAGS="-arch ppc -arch i386"
  MACOSX_DEPLOYMENT_TARGET=10.4
  ./configure  --disable-dependency-tracking

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pyplot should have a adjust_axes() function similar to adjust_subplots() (or not?)

2009-08-07 Thread John Hunter
On Fri, Aug 7, 2009 at 4:31 AM, Pim
Schellart wrote:
> Hi Everybody,
>
> Before I file a bug report / feature request I would like your input.
> I have large numbers displayed slanted for the axis tick labels.
> This causes the tick labels as well as the xlabel to fall of the figure.
> I know I can adjust the spacing by creating an axes instance manually
> but this requires me to step out of the normal pyplot/pylab workflow.
> Since subplots have a pyplot function adjust_subplots() and Subplot is
> nothing more (as far as I can tell) than more specialized Axes
> instance I believe there should also be a function like adjust_axes()
> which behaves in a similar way.
> What are your thoughts about this

I don't think it makes sense -- consider this case:

  http://matplotlib.sourceforge.net/examples/pylab_examples/axes_demo.html

what would the function do to the three axes?

It is true that subplots are nothing more than specialized axes, but
it is the way they are specialized that makes them amenable to a
subplots_adjust function.  They lie on a grid, so concepts like "left"
and "bottom" and "is first row" and "is last column" are well defined.
 The same cannot be said of the general Axes.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram example doesn't run

2009-08-07 Thread John Hunter
On Fri, Aug 7, 2009 at 4:10 AM, Bernd Eggink wrote:

> being a complete newbie, I tried to run the simple_plot example from the
> website with matplotlib-0.99.0. However, I get the error message:

> "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py",
> line 443, in __init__
>     self.window.set_icon_from_file(window_icon)
> glib.GError: Couldn't recognize the image file format for file
> '/usr/lib/python2.6/site-packages/matplotlib/mpl-data/images/matplotlib.svg'
> 
>
> It works with 0.98.5.3. Is this a bug or could anything be wrong with my

Christoph, is GTKAgg the default backend in the win32 installers?  It
should be TkAgg.  Are you creating a setp.cfg when you build your
installer, as described at

  http://matplotlib.sourceforge.net/devel/release_guide.html#packaging

For OSX and the python2.5 win32 binary I build, I use a Makefile to
create setup.cfg so I don't forget :-)

Or Bernd, did you explicitly set backend gtk in your matplotlib rc file (
http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#matplotlib-directory-location).
 Which installer dd you run (exact file name if you still have it)?

Also, I recall that we patched gtk to use the png not the svg icon for
win32 -- Bernd, what does your sys.platform report::

  >> import sys
  >>> sys.platform
  'linux2'

 We check in backend_gtk

if gtk.pygtk_version < (2, 8, 0) or sys.platform == 'win32':
icon_filename = 'matplotlib.png'
else:
icon_filename = 'matplotlib.svg'

so you shouldn't be hitting this bug if your platform is win32.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram example doesn't run

2009-08-07 Thread John Hunter
On Fri, Aug 7, 2009 at 7:47 AM, Bernd Eggink wrote:

>> Christoph, is GTKAgg the default backend in the win32 installers?  It
>> should be TkAgg.  Are you creating a setp.cfg when you build your
>> installer, as described at

Reminder to self: do not post before morning coffee.  For some reason
I thought you were on windows using on of Christoph's windows
installers.  Christoph, feel free to ignore this thread.

> Platform is 'linux2', and gtk.pygtk_version is (2, 14, 1).
>
> To get it working, I replaced matplotlib.svg by a link to matplotlib.png
> (which is pretty ugly, though). Maybe the error should be catched and
> the .png image used as a fallback.

Unfortunately, the exception glib.GError is gtk version dependent so I
can't easily catch it.  I am loathe to do a blanket except catch, but
I am not sure what the alternative is here.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram example doesn't run

2009-08-07 Thread John Hunter
On Fri, Aug 7, 2009 at 10:34 AM, John Hunter wrote:

> Unfortunately, the exception glib.GError is gtk version dependent so I
> can't easily catch it.  I am loathe to do a blanket except catch, but
> I am not sure what the alternative is here.

I committed a change to the release branch (I did not try setting the
png if the svg failed, I just give up on the icon) -- if you could
test from the svn repo:


svn co https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint
mpl99

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animate histogram

2009-08-08 Thread John Hunter
On Sat, Aug 8, 2009 at 6:17 AM, Kaushik
Ghose wrote:

> (http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Rectangle)
> e.g. set_height() to change the rectangles?
>
> e.g. code
> --
> import pylab
> x = pylab.rand(20)
> h = pylab.hist(x)
> h[2][0].set_height(1)
> pylab.draw()
> 

This is the right idea, but it is likely to be slow for animation,
since each rectangle is a separate mpl object, each with its own
graphics contexs, rendering step, etc.  bar and hist were very early
functions which I wrote before we had collections and compound paths.
If I were rewriting it from scratch, I would use a compound path.
It's a little more work upfront because you have to manually compute
the vertices and path codes, but it will be goo-gobs faster.  Here is
the animated histogram for tk using compound paths


"""
This example shows how to use a path patch to draw a bunch of
rectangles for an animated histogram
"""
import numpy as np
import matplotlib
matplotlib.use('TkAgg') # do this before importing pylab

import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.path as path

fig = plt.figure()
ax = fig.add_subplot(111)

# histogram our data with numpy
data = np.random.randn(1000)
n, bins = np.histogram(data, 100)

# get the corners of the rectangles for the histogram
left = np.array(bins[:-1])
right = np.array(bins[1:])
bottom = np.zeros(len(left))
top = bottom + n
nrects = len(left)

# here comes the tricky part -- we have to set up the vertex and path
# codes arrays using moveto, lineto and closepoly

# for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the
# CLOSEPOLY; the vert for the closepoly is ignored but we still need
# it to keep the codes aligned with the vertices
nverts = nrects*(1+3+1)
verts = np.zeros((nverts, 2))
codes = np.ones(nverts, int) * path.Path.LINETO
codes[0::5] = path.Path.MOVETO
codes[4::5] = path.Path.CLOSEPOLY
verts[0::5,0] = left
verts[0::5,1] = bottom
verts[1::5,0] = left
verts[1::5,1] = top
verts[2::5,0] = right
verts[2::5,1] = top
verts[3::5,0] = right
verts[3::5,1] = bottom

barpath = path.Path(verts, codes)
patch = patches.PathPatch(barpath, facecolor='green',
edgecolor='yellow', alpha=0.5)
ax.add_patch(patch)

ax.set_xlim(left[0], right[-1])
ax.set_ylim(bottom.min(), top.max())

def animate():
# simulate new data coming in
data = np.random.randn(1000)
n, bins = np.histogram(data, 100)
top = bottom + n
verts[1::5,1] = top
verts[2::5,1] = top
fig.canvas.draw()

def run():
for i in range(100):
fig.canvas.manager.window.after(100, animate)


fig.canvas.manager.window.after(100, run)
plt.show()


histogram_tkagg.py
Description: Binary data
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animate histogram

2009-08-08 Thread John Hunter
On Sat, Aug 8, 2009 at 9:00 AM, John Hunter wrote:

> """
> This example shows how to use a path patch to draw a bunch of
> rectangles for an animated histogram
> """

Oops, in my last post I have the timer logic wrong because the call is
non-blocking so the animation ran too fast -- a rare occurrence in the
world of mpl animation :-)

Here is the corrected example:

"""
This example shows how to use a path patch to draw a bunch of
rectangles for an animated histogram
"""
import time
import numpy as np
import matplotlib
matplotlib.use('TkAgg') # do this before importing pylab

import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.path as path

fig = plt.figure()
ax = fig.add_subplot(111)

# histogram our data with numpy
data = np.random.randn(1000)
n, bins = np.histogram(data, 100)

# get the corners of the rectangles for the histogram
left = np.array(bins[:-1])
right = np.array(bins[1:])
bottom = np.zeros(len(left))
top = bottom + n
nrects = len(left)

# here comes the tricky part -- we have to set up the vertex and path
# codes arrays using moveto, lineto and closepoly

# for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the
# CLOSEPOLY; the vert for the closepoly is ignored but we still need
# it to keep the codes aligned with the vertices
nverts = nrects*(1+3+1)
verts = np.zeros((nverts, 2))
codes = np.ones(nverts, int) * path.Path.LINETO
codes[0::5] = path.Path.MOVETO
codes[4::5] = path.Path.CLOSEPOLY
verts[0::5,0] = left
verts[0::5,1] = bottom
verts[1::5,0] = left
verts[1::5,1] = top
verts[2::5,0] = right
verts[2::5,1] = top
verts[3::5,0] = right
verts[3::5,1] = bottom

barpath = path.Path(verts, codes)
patch = patches.PathPatch(barpath, facecolor='green',
edgecolor='yellow', alpha=0.5)
ax.add_patch(patch)

ax.set_xlim(left[0], right[-1])
ax.set_ylim(bottom.min(), top.max())

def animate():
if animate.cnt>=100:
return

animate.cnt += 1
# simulate new data coming in
data = np.random.randn(1000)
n, bins = np.histogram(data, 100)
top = bottom + n
verts[1::5,1] = top
verts[2::5,1] = top
fig.canvas.draw()
fig.canvas.manager.window.after(100, animate)
animate.cnt = 0
fig.canvas.manager.window.after(100, animate)
plt.show()


histogram_tkagg.py
Description: Binary data
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] axes_grid examples

2009-08-10 Thread John Hunter
On Mon, Aug 10, 2009 at 5:05 AM, Gary Ruben wrote:
> Many of the axes_grid examples in the thumbnail gallery don't work out
> of the box with the latest matplotlib 0.99 because they rely on
> demo_image and demo_axes_divider modules. Should these have been
> packaged with 0.99 or were they left out deliberately?

We've addressed this already in svn HEAD, but the fixes won't be out
until mpl1.0.  For now, just drop the attached file in the same
directory as your example code (you may also need to touch a
__init__.py in that dir.

As developers, we run all of our code from the examples directory
(which has the data and files) but now that the website has actually
become useful, more and more people are running examples downloaded
from the server, and so they don't have the extra code and files that
some examples need.  We have mostly resolved this problem in svn HEAD,
but will be a little while before it makes it into a production
release, so you may want to check out the examples from svn

svn co 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib/examples
mpl_examples

JDH


demo_image.py
Description: Binary data
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting separated axes

2009-08-10 Thread John Hunter
On Sun, Aug 9, 2009 at 11:53 PM, per freem wrote:
> is there a way to plot separated axes in matplotlib? i.e. plots where
> the origin (0,0) has no meaning, either because the data on the x axes
> is categorical (e.g. you are plotting a histograms for three
> categories) or for other reasons. an example of what i mean is this
> graph:
>
> http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=82
>
> or this: http://msenux.redwoods.edu/math/R/graphics/hist1.gif
>
> any advice on how to do this would be greatly appreciated. thanks.

with matplotlib 0.99:

http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] axes_grid examples

2009-08-10 Thread John Hunter
On Mon, Aug 10, 2009 at 10:23 AM, Jae-Joon Lee wrote:
> John,
>
> I changed the axes_grid examples to use get_sample_data and committed
> them to the svn yesterday.
> However, these examples won't work unless the user uses mpl from the
> svn (I don't think get_sample_data is in 0.99 maint).
> But, at some point during the last dev cycle, I think the gallery in
> our web page started to show the examples from the svn. So, if we're
> going to repeat it again (I mean pushing the docs from the svn), I
> think I'd better revert those changes I made. And maybe modify them to
> run standalone.

I can keep building the website off the 0.99 branch until release 1.0,
so this shouldn't be a problem.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pylab

2009-08-11 Thread John Hunter
On Tue, Aug 11, 2009 at 12:28 PM, John [H2O] wrote:
>
> Just an thought regarding the whole PyLab concept...

If you would like to frame this as a FAQ "Should I import * from
pylab?" and post it as a rest svn diff against doc/faq/howto_faq.rst,
I would be happy to include this on the website

http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] building matplotlib from source in Linux

2009-08-11 Thread John Hunter
On Mon, Aug 10, 2009 at 1:09 PM, James Battat wrote:
> I'm installing matplotlib from source on a linux machine (system
> details below).  The module builds and installs without error.  I can
> import pylab successfully from an interactive python prompt.  When I
> plot data, however, pylab.show() brings up an empty plot window (gray
> background), and pylab.savefig("test.png") makes an empty image (white
> background).  I've tried rebuilding, but with no success (output also
> below).

Did you do a clean build and install, ie blow away both the build and
install dirs (as well as all the cached data in ~/.matplotlib for good
measure)

http://matplotlib.sourceforge.net/faq/installing_faq.html#cleanly-rebuild-and-reinstall-everything

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Graph title trepassing bounds

2009-08-11 Thread John Hunter
On Tue, Aug 11, 2009 at 2:21 PM, Gewton Jhames wrote:
> Hello everyone,
> my graph's title is been greater than the size of the graph.
> There's a way to get the width of the graph's title so I can increase the
> width of the graph based on it?

There probably is a way, but it might be easier to use a smaller
fontsize, or embed a new line in your title.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animate histogram

2009-08-18 Thread John Hunter
On Tue, Aug 18, 2009 at 12:53 PM, Alan G Isaac wrote:
> OK, I mostly understand John's example and have
> adapted it in the attached Histogram class, for
> whoever might care.  (The file is a working
> example.) Thanks!
>
> Here are my remaining questions.
>
> 1. To get a new histogram, I just change the
> data in the vertices object and then  ask my
> FigureCanvasTkAgg to ``show`` itself.  How
> does this work? (I suppose that this FigureCanvas
> has my figure, the figure references my axes, my axes
> references my PathPatch, and my PathPatch references
> the rectverts, and each looks to the next when I call
> show?)

if you have already created the tk gui window and shown it, just call

  fig.canvas.draw()

on each update of the vertices

> 2. This is pretty fast.  Would there be additional
> speed gains to blitting, and if so, how would it
> be done?  (I'm just asking for clues, not a complete
> example.)  I expected to be able to set the animated
> property on the patch when I called ax.add_patch,
> but that does not work; am I supposed to just set
> it directly? (I had supposed that the axes were
> being informed e.g. when setting animated=True
> for an ax.plot, but now I'm guessing that supposition
> is wrong the `plot` just provides this as a convenience.)

The animated property has to be on the patch itself, so when you
create the path patch, you would do

  patch = patches.PatchPath(path, animated=True)
  ax.add_patch(patch)

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] onpick on a 2 y plot ( via twinx() ) seems to only allow picking of second axes's artists

2009-08-19 Thread John Hunter
On Thu, Aug 13, 2009 at 12:51 PM, Erik Schweller wrote:
> Good day,
>
> I've hit an issue that may be a bug.  In a previous version of
> matplotlib (.98.x) I had a picker set for lines plotted on two axes.
> This was working until I upgraded to version 0.99.0.   Now the first
> axes's pick events never seem to fire even though they respond true if
> queried with pickable(). The second axes's pick events still fire.
>
> Using the example below, clicking on the left y's line will never
> print anything, but the sin from the right will if clicked on.

I'm not sure why it worked before -- that surprises me.  Only one axes
can receive the pick event currently, so if you have overlapping axes,
as you do with twinx, the one with the highest zorder will receive the
pick events.  By default, the zorder by the Axes is 0, so you could
raise the twinx axes, by increaseing the zorder

  ax2.set_zorder(0.1)

and then the line on that axes will respond to the pick events.  With
some work, we might be able to support multiple overlapping axes
handling a single pick event.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting on an "open box" with matplotlib?

2009-08-19 Thread John Hunter
On Thu, Aug 13, 2009 at 12:59 PM, Eric Ayars wrote:
> Hello,
>
> I've been using Gnuplot for years, but am quite impressed with what I
> see in matplotlib and am in the process of learning enough to switch.
> One item that I haven't been able to figure out yet is how to plot on
> an "open box".
>
> For example, in Gnuplot I would give the commands
>        set xtics nomirror
>        set ytics nomirror
>        set border 3
> and I would get a plot that only had left and bottom axes instead of a
> complete box.
>
> How do I get this "open box" plot with matplotlib?
>

This is new in matplotlib 0.99 -- is this what you are looking for

http://matplotlib.sourceforge.net/users/whats_new.html#axis-spine-placement

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot multiple times in one script fails

2009-08-19 Thread John Hunter
On Tue, Aug 18, 2009 at 3:55 AM, M. Hecht wrote:
> The first figure is drawn without problems but after closing it (by clicking
> the cross in the upper
> right corner of the window) the second figure cannot be plot anymore. What I
> wanted to do was
> to visualize all selected files of a directory one after the other. To do
> this I want to close the old
> figure and then the new figure should com up as long as there is a file to
> visualize left. Unfortunaltely
> only the first figure is shown as in the simple example.
> So, what's wrong

We don't really have support for blocking input where a program is
halted until you close the open figure, and then the next one loads.
You could write something using event handling, where on a key press
event the next figure was loaded.  You may also be able to use ginput
here, which will give you a blocking input function.

See

http://matplotlib.sourceforge.net/users/shell.html

http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.ginput

http://matplotlib.sourceforge.net/users/event_handling.html

http://matplotlib.sourceforge.net/examples/pylab_examples/ginput_demo.html

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


  1   2   3   4   5   6   7   8   9   10   >