Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-04-24 Thread Robert Cimrman
Hi Ryan,

Ryan May wrote:
> On Thu, Apr 23, 2009 at 4:16 PM, Esmail  wrote:
> 
>> Ryan May wrote:
>>> Try this:
>>>
>>>
>> http://matplotlib.sourceforge.net/examples/animation/simple_anim_gtk.html
>>> (If not gtk, there are other examples there.)
>> Thanks Ryan, that'll give me some idea with regard to the animation,
>> and real-time drawings.
>>
>> Any idea if it's possible to finish a Python program but still have the
>> graph showing?
>>
>> FWIW, I'm doing this under Linux.
>>
> 
> You'd have to run the plotting in a separate process from the computation.
> subprocess would let you do that, assuming you can spin off a child task
> that stays alive when the parent exits.  You'd also need to get the
> computing process to give new results to the child plot, maybe using a pipe
> (which I think subprocess can handle as well.)

This is exactly what I have tried/described in [1], using the 
multiprocessing module. It sort of works, but I have that hanging 
problem at the end - maybe somebody jumps in and helps this time :)

r.

[1] 
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg10873.html

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-04-24 Thread Esmail
Ryan May wrote:
> 
> Any idea if it's possible to finish a Python program but still have the
> graph showing?
> 
> FWIW, I'm doing this under Linux.
> 
> 
> You'd have to run the plotting in a separate process from the 
> computation.  subprocess would let you do that, assuming you can spin 
> off a child task that stays alive when the parent exits.  You'd also 
> need to get the computing process to give new results to the child plot, 
> maybe using a pipe (which I think subprocess can handle as well.)

Thanks Ryan, I have been meaning to explore Python's
threading/multi-processing facilities, so this will provide a
good excuse to do so :-)  [when I find the time... so much to learn,
so little time]


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-04-24 Thread Robert Cimrman
Esmail wrote:
> Robert Cimrman wrote:
>> This is exactly what I have tried/described in [1], using the 
>> multiprocessing module. It sort of works, but I have that hanging 
>> problem at the end - maybe somebody jumps in and helps this time :)
>>
>> r.
>>
>> [1] 
>> http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg10873.html
> 
> Hi,
> 
> Sounds interesting, but I get a "page not found 404" type error when
> I follow this link.

Strange, it does work for me. Alternatively, just search
"[Matplotlib-users] plotting in a separate process" in google...

r.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-04-24 Thread Esmail
Robert Cimrman wrote:
> 
> This is exactly what I have tried/described in [1], using the 
> multiprocessing module. It sort of works, but I have that hanging 
> problem at the end - maybe somebody jumps in and helps this time :)
> 
> r.
> 
> [1] 
> http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg10873.html

Hi,

Sounds interesting, but I get a "page not found 404" type error when
I follow this link.

Esmail


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] SpanSelector on multiple figures

2009-04-24 Thread fjldurodie
Hi,

Thanks for your reply :

I think I will try and follow your last suggestion by passing a callback 
function that is defined through another function (this is because the 
program generates a series of figures that are all similar) :

def gen_onselect(ax):
def onselect:
   # do the stuff here that requires to know which axes
return onselect

and then use

span = SpanSelector(ax, gen_onselect(ax), 'horizontal', useblit=True,
rectprops=dict(alpha=0.25, facecolor='blue') )

I'll let you know if this works or not.

Kind regards,
Frederic

Jae-Joon Lee wrote:
> On Mon, Apr 20, 2009 at 4:09 PM, fjldurodie
>  wrote:
>   
>> Hi,
>>
>> I'm wondering if it is possible to use SpanSelector on multiple figures
>> : my problem is that I can't think of a way to tell the onselect on
>> which axes(ses) of which figure it should try and do something. The
>> example works because there is only one SpanSelector active and "it"
>> therefore knows which axes "it" should redraw.
>>
>> For it to work on multiple figures (say I have a series of events that I
>> plot in a similar way each in a separate figure and I would like a
>> SpanSelector feature on each of the figures) I would need to have a
>> reference to which axes called the onselect through SpanSelector : then
>> I could get the axes's figure and manipulate the other subplots on that
>> figure accordingly.
>> 
>
> Mouse event in mpl has a "inaxes" property. However, SpanSelector hide
> event information from users.
>
> On the other hand, the first argument of the SpanSelector is the
> "axes" that you want to use. So, I'm not sure what your point is. You
> already know the axes you're working with. Can't you just use
> different callbacks for different axes?
>
> -JJ
>
>
>   
>> Is there a way of doing this ?
>>
>> Kind regards,
>> Frederic
>>
>> --
>> Stay on top of everything new and different, both inside and
>> around Java (TM) technology - register by April 22, and save
>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
>> 300 plus technical and hands-on sessions. Register today.
>> Use priority code J9JMT32. http://p.sf.net/sfu/p
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>> 
>
> --
> Stay on top of everything new and different, both inside and 
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today. 
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>   


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Segmentation fault using imshow on large image

2009-04-24 Thread Michael Droettboom
On my machine (32-bit Fedora 10 with 2GB RAM), it chugs along swapping 
for a lng time and then fails with a Python MemoryError exception -- 
which is at least reasonable.

I suspect you're running on a 64-bit machine and we're running into some 
sort of non-64-bit-clean issue.  We try to be 64-bit clean, but it 
doesn't get verified on a regular basis, and not all of us (myself 
included) are running 64-bit OSes.

Can you try running python inside of gdb and getting a traceback?  That 
might provide some clues.

We can estimate a little bit as to the memory requirements -- though 
it's hard to account for everything.

Input array is (10370, 9320) x 4 = 386MB
This array is always converted to doubles to convert to colors (this is 
probably a place ripe for opimtization) so you get also 786MB.
Then this gets converted to an RGBA array for another 386MB

Mike

Adam Ginsburg wrote:
> Hi, I've been getting a segmentation fault when trying to display
> large images.  A transcript of a sample session is below.  I'm using
> the TkAgg backend, and I am using numpy, but otherwise I have made no
> modifications to the matplotlib setup.
>
>
> milkyway /data/glimpseii $ alias pylab
> alias pylab='/usr/local/adm/config/python/bin/ipython -pylab -log'
> milkyway /data/glimpseii $ pylab
> Activating auto-logging. Current session state plus future input saved.
> Filename   : ipython_log.py
> Mode   : rotate
> Output logging : False
> Raw input log  : False
> Timestamping   : False
> State  : active
> Python 2.5 (r25:51908, Dec 22 2006, 16:08:43)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.9.1 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object'. ?object also works, ?? prints more.
>
>   Welcome to pylab, a matplotlib-based Python environment.
>   For more information, type 'help(pylab)'.
>
> In [1]: import matplotlib,pyfits,numpy,scipy
>
> In [2]: scipy.__version__
> Out[2]: '0.7.0'
>
> In [3]: numpy.__version__
> Out[3]: '1.3.0'
>
> In [4]: matplotlib.__version__
> Out[4]: '0.98.5.2'
>
> In [5]: f = pyfits.open('GLM_00600+_mosaic_I3.fits')
>
> In [6]: f[0].data.shape
> Out[6]: (10370, 9320)
>
> In [7]: f[0].data.dtype
> Out[7]: dtype('>f4')
>
> In [8]: imshow(f[0].data)
> Segmentation fault
>
>
> Any ideas?
>
> Thanks,
> Adam
>
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensign 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
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] subplots and text?

2009-04-24 Thread granquet
Hello,
I just discovered matplotlib (and python).
I got things running pretty fast/easily (thx to the good documentation)
but I got a problem with texts and subplots.

-text tend to overlap previous subplots. this is more annoying than a 
real issue ... but still, It looks blatantly dirty... I had no success 
with zorder

-text overlaps, is there a way to "automagically place" text so that 
overlapping is minimal?
taking into account that my text labels are only constrained on X and 
can be moved freely on Y
I would happily get the boundaries of the text labels and sort my x/y 
coordinates myself, but I couldn't find such boundaries.

for the record: I'm plotting some system datas (like cpu/ram/disk usage) 
over time and placing dbus calls over that
at the moment, I got 5 subplots vertically arranged sharing the same x axis
I represent dbus calls with axvlines and annotate them with some dbus 
infos (usually 15 chars)

thx for your time, and the nice piece of software :)

This message contains confidential information and may contain information that 
is legally privileged.  If you have received this message by mistake, please 
immediately notify us and delete the original message. Thank you.  

Ce message contient des informations confidentielles.  S'il vous est parvenu 
par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire 
aucun usage et de n'en garder aucune copie.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Animation with copy_from_bbox / restore_region.

2009-04-24 Thread Jae-Joon Lee
On Thu, Apr 23, 2009 at 2:32 PM, Elan Pavlov  wrote:
> Hi Jae-Joon,
> Thanks a ton! The problem is actually not the frequency of changes.
> The current method uses draw_artist on each update. However, the time
> for draw_artist is linear in the *number* of points so for graphs with
> a large amount of data it is extremely inefficient. Your patch means
> that update time is linear in the amount of data *updated* and not in
> the total amount of data.
> As for the ticks you have a point. In my application I actually want
> ticks to be shifted (as time goes on) so indeed this is what I want.

I was more concerned about yticks (when images are shifted in
x-direction). Anyhow, it should be not that difficult to handle this.

> In general ticks that are shifted out can be redrawn using set_data
> methods which are efficient since a tick can be defined as it's
> endpoints. Basically when first calling plot() I set all of the tick
> locators to Null and then just add ticks as a line (with two points)
> based on the desired spacing. Changing a tick location (or if desired
> redrawing it in the same location) is basically a call to
> set_(x|y)data and then draw_artist for a line with two points (or a
> line collection will *slightly* improve performance  if needed).
> Anyway, thanks again. I'll play around with it and let you know what I
> run into.

Yes, please.
If you find this useful, I'll try to push this into the trunk.

Regards,

-JJ


>
> Elan
> ---
> I can no other answer make but thanks,
> And thanks, and ever thanks.
>    -- William Shakespeare
>
> On Thu, Apr 23, 2009 at 1:21 PM, Jae-Joon Lee  wrote:
>> On Mon, Apr 20, 2009 at 4:34 PM, Elan Pavlov  wrote:
>>> Hi,
>>>
>>> I'm trying to use matplotlib for animating data as it is received from an
>>> online source (online in the algorithmic sense not internet:). I'd like
>>> the graph plot to be updated with high frequency since the data changes
>>> rapidly. I've used the BufferRegion with copy_from_bbox / restore_region
>>> and it speeds up the plotting considerably but alas it's still not good
>>> enough (with a large number of graphs and a large number of data points in
>>> each graph).
>>>
>>
>> Well, if you need your plot updated with very high frequency, MPL may
>> not be your tool of choice.
>> Anyhow, my first recommendation is not to update the plot frequently.
>> I mean, do you have to update the plot for every changes? Can you
>> update it every 10th change, for example?
>>
>>> What I'd like to do is to utilize the fact that the animation is updated
>>> in a predictable fashion (i.e., scrolling off the screen to the left as
>>> new data arrives) in order to speed up the animation. The idea would be to
>>> copy the right 99% of the graph (or some other fraction) via some kind of
>>> function similar to copy_from_bbox, move it 1% to the left and then plot
>>> the new 1% of the data. The problem is that as far as I can tell the
>>> copy_from_bbox/restore_region does not actually allow changing the area in
>>> which it is restored. I've mucked around in the source files a bit but to
>>> no avail.
>>>
>>> My question is then:
>>> 1. Is there some other way to copy everything enclosed in a Bbox? or
>>> 2. Is there some way to modify the region in which data reappears when
>>> using restore_region?
>>> 3. Perhaps I'm missing something?
>>>
>>> I'm sure someone else has done this since it seems pretty natural and
>>> useful for a variety of applications.
>>
>> I'm attaching a patch that might do what you want to do.
>> It implements a "restore_bbox2" method which restores a subset of the
>> saved background at a specified position.
>> A small example is also attached (it is based on the gtk backend).
>>
>> I, personally, am not sure if this kind of feature is useful. If you
>> shift part of your figure, you have to be careful not to mess up with
>> the coordinate system. And also be careful about what to be shifted
>> and what to be not (e.g., ticks).
>>
>> If others find this useful, I'll commit this to the trunk with some
>> api improvement.
>>
>> Regards,
>>
>> -JJ
>>
>>
>>>
>>> Elan
>>> 
>>> "If stupidity got us into this mess, why can't it get us out?"
>>>        - Will Rogers
>>>
>>> --
>>> Stay on top of everything new and different, both inside and
>>> around Java (TM) technology - register by April 22, and save
>>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
>>> 300 plus technical and hands-on sessions. Register today.
>>> Use priority code J9JMT32. http://p.sf.net/sfu/p
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>> --
>> Stay on top of everything new and different, both inside and
>> around Java (TM) technology -

Re: [Matplotlib-users] subplots and text?

2009-04-24 Thread Ryan May
On Fri, Apr 24, 2009 at 8:41 AM, granquet  wrote:

> Hello,
> I just discovered matplotlib (and python).
> I got things running pretty fast/easily (thx to the good documentation)
> but I got a problem with texts and subplots.
>
> -text tend to overlap previous subplots. this is more annoying than a
> real issue ... but still, It looks blatantly dirty... I had no success
> with zorder
>
> -text overlaps, is there a way to "automagically place" text so that
> overlapping is minimal?
> taking into account that my text labels are only constrained on X and
> can be moved freely on Y
> I would happily get the boundaries of the text labels and sort my x/y
> coordinates myself, but I couldn't find such boundaries.
>
> for the record: I'm plotting some system datas (like cpu/ram/disk usage)
> over time and placing dbus calls over that
> at the moment, I got 5 subplots vertically arranged sharing the same x axis
> I represent dbus calls with axvlines and annotate them with some dbus
> infos (usually 15 chars)


Matplotlib doesn't have the ability to automatically space out the text.
You can force your subplots to be further apart (and leave room for more
text) using the pyplot.subplots_adjust command.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] mail-archive URLs on gmane (was: 2 simple ??: program exit w/graph, update graph real-time)

2009-04-24 Thread Jouni K . Seppänen
Esmail  writes:

>> http://www.mail-archive.com/matplotlib-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
>> @public.gmane.org/msg10873.html
>
> Sounds interesting, but I get a "page not found 404" type error when
> I follow this link.

That's because you are reading the list via Gmane, which is set to
mangle email addresses to avoid spammers (the setting is specific to
each mailing list, so you might not see it on other lists), and
mail-archive URLs happen to contain the email address of the list. 

To follow the URL, replace the part

  matplotlib-users-random-garbage  public.gmane.org

with

  matplotlib-users  lists.sourceforge.net

(where I am writing  instead of @ to evade the gmane mangler).

I wonder if URL-escaping the at sign helps:

http://www.mail-archive.com/matplotlib-users%40lists.sourceforge.net/msg10873.html

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting updated axes bounding box

2009-04-24 Thread Jae-Joon Lee
Hi Ryan,

The Axes in the svn version of the mpl has a "axes_locator" property ,
which is meant to be used to update the location of the axes at the
drawing time.

Try to insert the following code before the "show" and see if it works for you.

 from matplotlib.transforms import Bbox
 def update_pos(cbar_axes, renderer):
 cpos = list(ax.get_position().bounds)
 cpos[-1] = colorbar_height
 return Bbox.from_bounds(*cpos)
 cax.set_axes_locator(update_pos)


Also, you may be interested in the "axes_grid" toolkit that I recently
checked in to the trunk, although it would be a bit more tricky to
place the colorbar at the bottom of the axes. Anyhow, you may take a
look at "examples/axes_grid/demo_axes_divider.py".

Regards,

-JJ


On Thu, Apr 23, 2009 at 6:12 PM, Ryan May  wrote:
> Hi,
>
> I'm trying to make a colorbar that occupies the bottom extent of an axes:
>
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.colorbar import ColorbarBase
> from matplotlib.colors import Normalize
>
> colorbar_height = 0.02
>
> data = np.random.randn(10,10)
> fig = plt.figure()
> ax = fig.add_subplot(1, 1, 1)
>
> norm = Normalize(-4, 4)
> cmap = plt.get_cmap('spring')
>
> ax.imshow(data, norm=norm, cmap=cmap)
>
> cpos = list(ax.get_position().bounds)
> cpos[-1] = colorbar_height
>
> cax = fig.add_axes(cpos)
> cbar = ColorbarBase(cax, norm=norm, cmap=cmap, orientation='horizontal')
> cax.xaxis.set_ticks_position('
> top')
> cax.xaxis.set_ticks_position('both')
>
> plt.show()
>
> The problem is, because this is an image, at draw time, the axes aspect
> ratio (and hence its bounds) get updated, but the colorbar does not get this
> update.  This produces a colorbar much longer than the actual extent of the
> axes. (See attached.)  Is there a way to give the colorbar axes a bbox that
> is modified but still linked to the axes bbox?  Or is there a way to force
> the axes to update its bbox before being drawn?  I showed off a version of
> this code that worked great in the interactive shell earlier, but I'm having
> an epic fail at getting this to work within a script.  I've taken this same
> approach before, but I think I've just been lucky in how the axes aspect
> ratio was handled.
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> Sent from Norman, Oklahoma, United States
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensign 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
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Integrating matplotlib into a GUI

2009-04-24 Thread Gökhan SEVER
Hello,

So far, I have been spending many nice hours using matplotlib from within an
IPython shell. However, the number of variables that are inside my session
is getting higher the more I deep into data analysis. As a result I want to
go one step further and carry my efforts on integrating matplotlib with a
GUI as is shown similar in the uploaded screenshot (
http://img258.imageshack.us/img258/1046/cplot.png).

I know wxPython or PyQt seems way to go on this issue. But (there is always
this but :) there is Chaco on the Enthought side and with nicely and simply
integration with Traits and Traits UI.

Are there anybody in the group that design a similar tool for their
scientific data analysis needs? Could I get some insight into this? Any
recommendations or pointers? Why's and why not's?

Thank you

Gökhan
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] subplots and text?

2009-04-24 Thread granquet
Ryan May wrote:
> On Fri, Apr 24, 2009 at 8:41 AM, granquet  > wrote:
>
> Hello,
> I just discovered matplotlib (and python).
> I got things running pretty fast/easily (thx to the good
> documentation)
> but I got a problem with texts and subplots.
>
> -text tend to overlap previous subplots. this is more annoying than a
> real issue ... but still, It looks blatantly dirty... I had no success
> with zorder
>
> -text overlaps, is there a way to "automagically place" text so that
> overlapping is minimal?
> taking into account that my text labels are only constrained on X and
> can be moved freely on Y
> I would happily get the boundaries of the text labels and sort my x/y
> coordinates myself, but I couldn't find such boundaries.
>
> for the record: I'm plotting some system datas (like cpu/ram/disk
> usage)
> over time and placing dbus calls over that
> at the moment, I got 5 subplots vertically arranged sharing the
> same x axis
> I represent dbus calls with axvlines and annotate them with some dbus
> infos (usually 15 chars)
>
>
> Matplotlib doesn't have the ability to automatically space out the 
> text.  You can force your subplots to be further apart (and leave room 
> for more text) using the pyplot.subplots_adjust command.
>
> Ryan
>
> -- 
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
alright, so I'll have to do it on my own! any hints on where to start?
for the moment I'll forget the problem with overlapping text on 
subplots, I gotta fix the plotted texts overlaped in the same subplot.

I intend to get the bbox of the text, and adjust the next plotted text y 
value with an offset equals the height of the bounding box.
it seems feasable.

but I need some feedback, is that the good way? are the bounding boxe 
sizes relative to figure size or absolute (axis values, ie: dependant of 
scaling/zooming)?

has anyone ever done that (or similar)?

Guillaume Ranquet.

This message contains confidential information and may contain information that 
is legally privileged.  If you have received this message by mistake, please 
immediately notify us and delete the original message. Thank you.  

Ce message contient des informations confidentielles.  S'il vous est parvenu 
par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire 
aucun usage et de n'en garder aucune copie.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-04-24 Thread Ryan May
On Fri, Apr 24, 2009 at 5:52 AM, Esmail  wrote:

> Ryan May wrote:
> >
> > Any idea if it's possible to finish a Python program but still have
> the
> > graph showing?
> >
> > FWIW, I'm doing this under Linux.
> >
> >
> > You'd have to run the plotting in a separate process from the
> > computation.  subprocess would let you do that, assuming you can spin
> > off a child task that stays alive when the parent exits.  You'd also
> > need to get the computing process to give new results to the child plot,
> > maybe using a pipe (which I think subprocess can handle as well.)
>
> Thanks Ryan, I have been meaning to explore Python's
> threading/multi-processing facilities, so this will provide a
> good excuse to do so :-)  [when I find the time... so much to learn,
> so little time]


I was curious, so I cooked up a quick demo using two scripts.  Put them in
the same directory and run datasource.py.  It's not perfect, and I think the
use of raw_input() is a little odd, but it works.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States


datasource.py
Description: Binary data


plotter.py
Description: Binary data
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] SpanSelector on multiple figures

2009-04-24 Thread Jae-Joon Lee
On Fri, Apr 24, 2009 at 4:09 AM, fjldurodie  wrote:
> Hi,
>
> Thanks for your reply :
>
> I think I will try and follow your last suggestion by passing a callback
> function that is defined through another function (this is because the
> program generates a series of figures that are all similar) :
>
> def gen_onselect(ax):
>   def onselect:
>      # do the stuff here that requires to know which axes
>   return onselect
>
> and then use
>
> span = SpanSelector(ax, gen_onselect(ax), 'horizontal', useblit=True,
>                   rectprops=dict(alpha=0.25, facecolor='blue') )
>

I think this is common practice in event handling.

The partial function can be handy.

http://docs.python.org/library/functools.html

Regards,

-JJ



> I'll let you know if this works or not.
>
> Kind regards,
> Frederic
>
> Jae-Joon Lee wrote:
>>
>> On Mon, Apr 20, 2009 at 4:09 PM, fjldurodie
>>  wrote:
>>
>>>
>>> Hi,
>>>
>>> I'm wondering if it is possible to use SpanSelector on multiple figures
>>> : my problem is that I can't think of a way to tell the onselect on
>>> which axes(ses) of which figure it should try and do something. The
>>> example works because there is only one SpanSelector active and "it"
>>> therefore knows which axes "it" should redraw.
>>>
>>> For it to work on multiple figures (say I have a series of events that I
>>> plot in a similar way each in a separate figure and I would like a
>>> SpanSelector feature on each of the figures) I would need to have a
>>> reference to which axes called the onselect through SpanSelector : then
>>> I could get the axes's figure and manipulate the other subplots on that
>>> figure accordingly.
>>>
>>
>> Mouse event in mpl has a "inaxes" property. However, SpanSelector hide
>> event information from users.
>>
>> On the other hand, the first argument of the SpanSelector is the
>> "axes" that you want to use. So, I'm not sure what your point is. You
>> already know the axes you're working with. Can't you just use
>> different callbacks for different axes?
>>
>> -JJ
>>
>>
>>
>>>
>>> Is there a way of doing this ?
>>>
>>> Kind regards,
>>> Frederic
>>>
>>>
>>> --
>>> Stay on top of everything new and different, both inside and
>>> around Java (TM) technology - register by April 22, and save
>>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
>>> 300 plus technical and hands-on sessions. Register today.
>>> Use priority code J9JMT32. http://p.sf.net/sfu/p
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>>
>> --
>> Stay on top of everything new and different, both inside and around Java
>> (TM) technology - register by April 22, and save
>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
>> 300 plus technical and hands-on sessions. Register today. Use priority
>> code J9JMT32. http://p.sf.net/sfu/p
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] revision 7064 compile bug :

2009-04-24 Thread Xavier Gnata
Hi,

I'm trying to compile revision 7064 on a fresh kubuntu 9.04

I get this error:

g++ -pthread -shared -Wl,-O1 
-Wl,-Bsymbolic-functionsbuild/temp.linux-x86_64-2.6/src/agg_py_transforms.o 
build/temp.linux-x86_64-2.6/src/_gtkagg.obuild/temp.linux-x86_64-2.6/src/mplutils.o
 
build/temp.linux-x86_64-2.6/CXX/IndirectPythonInterface.o 
build/temp.linux-x86_64-2.6/CXX/cxx_extensions.o 
build/temp.linux-x86_64-2.6/CXX/cxxsupport.o 
build/temp.linux-x86_64-2.6/CXX/cxxextensions.o -L/usr/local/lib 
-L/usr/local/lib -L/usr/local/lib -lstdc++ -lm -lfreetype -lz-lstdc++ 
-lm -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 
-lgdk_pixbuf-2.0 -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 
-lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -o 
build/lib.linux-x86_64-2.6/matplotlib/backends/_gtkagg.so
/usr/bin/ld: cannot find -lz-lstdc++
collect2: ld returned 1 exit status

-lz-lstdc++ ?? Should it be -lz -lstdc++ (with one space...)
Looks like something is broken...but I'm not sure it is a matplotlib or 
a kubuntu bug
If someone have a clue...please tell me :)

Xavier

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] GSoC: TeX rendering engine

2009-04-24 Thread Freddie Witherden

Hi all,

Sorry it has taken me so long to get back to you all however I am in  
the middle of exam season and so time is scarce.


For the most part the (current) code is agnostic with regards to the  
rendering backend. The only real functionality required is the ability  
to draw lines and plot glyphs (which includes getting extents). As a  
result there currently exists support for many backends. I see no  
reason why a production-ready version of the library will not provide  
the same.


However, my primary focus will be on Cairo and Qt backends. These are  
widely used, allow for high quality output in various formats (PDF,  
PNG and SVG being the big three) and are well tested.


The lack of a C++/C library should not be a major issue. Python is  
very well established in the fields that the library is likely to be  
of most use (web, graphing, visualisation) and where it isn't there  
will most certainly be a command-line tool


Regards, Freddie.


PGP.sig
Description: This is a digitally signed message part
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] two scales in the same plot

2009-04-24 Thread Ondrej Certik
Hi,

is there a way to have one plot with two functions, one using some
scale, the other one a different scale and show for example one scale
on the left, the other scale on the right?

I want to plot an atomic potential (one scale) and the corresponding
wave functions (different scale) in the same plot. I tried to look
through all examples and search this list, but didn't find anything.

Thanks a lot,
Ondrej

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] two scales in the same plot

2009-04-24 Thread Sandro Tosi
Hi Ondrej,
nice to see you here :)

On Fri, Apr 24, 2009 at 22:02, Ondrej Certik  wrote:
> Hi,
>
> is there a way to have one plot with two functions, one using some
> scale, the other one a different scale and show for example one scale
> on the left, the other scale on the right?

sure, twinx() is what you're looking for; here is a simple example:

import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0., np.e, 0.01)
y1 = np.exp(-x)
y2 = np.log(x)
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(x, y1)
ax1.set_ylabel('Y values for exp(-x)')
ax2 = ax1.twinx()
ax2.plot(x, y2, 'r')
ax2.set_xlim([0,np.e])
ax2.set_ylabel('Y values for ln(x)')
ax2.set_xlabel('Same X for both exp(-x) and ln(x)')

The values on X has to be of the same scale, tough, else the graph
would look really weird.

Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] two scales in the same plot

2009-04-24 Thread Ryan May
On Fri, Apr 24, 2009 at 3:02 PM, Ondrej Certik  wrote:

> Hi,
>
> is there a way to have one plot with two functions, one using some
> scale, the other one a different scale and show for example one scale
> on the left, the other scale on the right?
>
> I want to plot an atomic potential (one scale) and the corresponding
> wave functions (different scale) in the same plot. I tried to look
> through all examples and search this list, but didn't find anything.


Look at pyplot.twinx() or pyplot.twiny()

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] two scales in the same plot

2009-04-24 Thread Jouni K . Seppänen
Ondrej Certik  writes:

> is there a way to have one plot with two functions, one using some
> scale, the other one a different scale and show for example one scale
> on the left, the other scale on the right?

Yes, with twinx: see 

http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=twinx#matplotlib.pyplot.twinx

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-04-24 Thread Robert Cimrman
Ryan May wrote:
> On Fri, Apr 24, 2009 at 5:52 AM, Esmail  wrote:
> 
>> Ryan May wrote:
>>> Any idea if it's possible to finish a Python program but still have
>> the
>>> graph showing?
>>>
>>> FWIW, I'm doing this under Linux.
>>>
>>>
>>> You'd have to run the plotting in a separate process from the
>>> computation.  subprocess would let you do that, assuming you can spin
>>> off a child task that stays alive when the parent exits.  You'd also
>>> need to get the computing process to give new results to the child plot,
>>> maybe using a pipe (which I think subprocess can handle as well.)
>> Thanks Ryan, I have been meaning to explore Python's
>> threading/multi-processing facilities, so this will provide a
>> good excuse to do so :-)  [when I find the time... so much to learn,
>> so little time]
> 
> 
> I was curious, so I cooked up a quick demo using two scripts.  Put them in
> the same directory and run datasource.py.  It's not perfect, and I think the
> use of raw_input() is a little odd, but it works.

Nice! I will try using the subprocess module instead of multiprocessing, 
as your example works for me.

Thanks!
r.

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] revision 7064 compile bug :

2009-04-24 Thread Eric Firing
Xavier Gnata wrote:
> Hi,
> 
> I'm trying to compile revision 7064 on a fresh kubuntu 9.04
> 
> I get this error:
> 
> g++ -pthread -shared -Wl,-O1 
> -Wl,-Bsymbolic-functionsbuild/temp.linux-x86_64-2.6/src/agg_py_transforms.o 
> build/temp.linux-x86_64-2.6/src/_gtkagg.obuild/temp.linux-x86_64-2.6/src/mplutils.o
>  
> build/temp.linux-x86_64-2.6/CXX/IndirectPythonInterface.o 
> build/temp.linux-x86_64-2.6/CXX/cxx_extensions.o 
> build/temp.linux-x86_64-2.6/CXX/cxxsupport.o 
> build/temp.linux-x86_64-2.6/CXX/cxxextensions.o -L/usr/local/lib 
> -L/usr/local/lib -L/usr/local/lib -lstdc++ -lm -lfreetype -lz-lstdc++ 
> -lm -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 
> -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 
> -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -o 
> build/lib.linux-x86_64-2.6/matplotlib/backends/_gtkagg.so
> /usr/bin/ld: cannot find -lz-lstdc++
> collect2: ld returned 1 exit status
> 
> -lz-lstdc++ ?? Should it be -lz -lstdc++ (with one space...)
> Looks like something is broken...but I'm not sure it is a matplotlib or 
> a kubuntu bug
> If someone have a clue...please tell me :)

Works for me on Ubuntu 9.04 (32-bit), and I can't imagine how the 
differences between Kubuntu and Ubuntu could be related to this.

Eric
> 
> Xavier
> 
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensign 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
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users