Re: [Matplotlib-users] delete instance of axvspan

2008-02-12 Thread Pierre GM
On Tuesday 12 February 2008 12:07:21 Michael Frauens wrote:
 I am using span selector to identify an area and then highlight in in
 green.  I want the user to be able to validate this (or not) and then
 select another area (or not).  However, when the user selects the alternate
 area I want the previous instance of axvspan to be deleted/removed.  How do
 I remove this instance?  of do I have to delete the whole plot and replot?

 Removing the instance is strongly preferred becauase the user may of
 altered the display using the canvas widgets.

Michael,
I have more or less  the same issue: I need to be able to highlight one 
particular curve among many. I have implemented a special subclass of Axes 
for my particular problem. This subclass has a method highlight
Here's a rough draft of what I do:

def __init__(self,*args,**kwargs)
Subplot.__init__(self,*args,**kwargs)
sefl.highlightedfreq = None

def highlight(bandwidth, **options):
if (self.highlightedfreq is not None) and \
   (self.highlightedfreq != bandwidth):
del self.lines[self.highlightedline]
self.highlightedfreq = bandwidth
self.plot(current._dates-shift, current._series, lw=lw, ls=ls, c=c,
  scalex=False, scaley=False)
self.highlightedline = len(self.lines)-1#
return self.highlightedline

As you see, I have an extra attribute (highlightedfreq) that stores the index 
of the highlighted line: when I need to deselect the highlighted curve, I 
just delete the corresponding element of the lines list.

HIH
P.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting from xemacs always 1 step behind

2008-02-12 Thread Neal Becker
Phil Austin wrote:

 John Hunter wrote:
  
   Well, the problem is that GTK, WX and Qt require threading support to
   use them properly interactively.  ipython has special modes for these
   to run the GUI mainloop in the separate thread.  tk is special in this
   regard, in that it runs from a standard python shell w/o threading
   support.  You may be able to configure ipython within xemacs to take
   advantage of both xemacs and ipython's support for interactive qt
   plotting in pylab.
 
 FWIW, everything's working correctly for me using
 xemacs + ipython:
 
 Xemacs 21.5
 current svn snapshot of python-mode.el from
http://sourceforge.net/projects/python
 current ipython svn snapshot
 Centos 5.1 and python 2.5.1
 
Works for me if invoked from xemacs shell as ipython -pylab.

If invoked from M-x py-shell doesn't work.

Now if I could just figure out where to modify the way py-shell invokes
ipython to add the -pylab.  Doc say C-u M-x py-shell would prompt for args,
but the doc lies.


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting from xemacs always 1 step behind

2008-02-12 Thread John Hunter
On Feb 12, 2008 12:17 PM, Neal Becker [EMAIL PROTECTED] wrote:

 If invoked from M-x py-shell doesn't work.

 Now if I could just figure out where to modify the way py-shell invokes
 ipython to add the -pylab.  Doc say C-u M-x py-shell would prompt for args,
 but the doc lies.

You can probably get help with this on the ipython mailing list.

JDH

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting from xemacs always 1 step behind

2008-02-12 Thread Phil Austin
John Hunter wrote:
  On Feb 12, 2008 12:17 PM, Neal Becker [EMAIL PROTECTED] wrote:
 
  If invoked from M-x py-shell doesn't work.
 
  Now if I could just figure out where to modify the way py-shell invokes
  ipython to add the -pylab.  Doc say C-u M-x py-shell would prompt 
for args,
  but the doc lies.

I use:

(require `python-mode)
; for python-mode.el from http://sourceforge.net/projects/python
; If you are using the default emacs python-mode, comment out the following
; two lines
(setq py-shell-switch-buffers-on-execute nil)
(setq py-python-command-args '(-pylab  -colors LightBG -p phil))
(require `ipython)


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] basemap and omerc

2008-02-12 Thread Evan Mason
Hi, I am having some problems using the oblique mercator projection in
basemap.  I want to define a rectangular orthogonal grid, rotated clockwise
by about 13 degrees.  I want to define grid cells of size, say, about 20x20
km.  The script I have so far is below.  The problem is that at some point
(the makegrid step) I lose the rotation, as seen in the plot.

I'd appreciate any help with this, thanks, Evan


from matplotlib.toolkits.basemap import Basemap

M = Basemap(projection = 'omerc',   \
   resolution  = None,   \
   llcrnrlon  = -43.7,   \
   llcrnrlat   = 14.7,\
   urcrnrlon = -4.0,\
   urcrnrlat  = 41.9,\
   lat_2   = 11.0,\
   lat_1   = 45.5,\
   lon_2  = -27.8,   \
   lon_1  = -19.9)

dl = 2.
nx = int((M.xmax - M.xmin) / dl) + 1
ny = int((M.ymax - M.ymin) / dl) + 1

lonr, latr = M.makegrid(nx, ny)

plot(lonr, latr, 'c.')
show()
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] delete instance of axvspan

2008-02-12 Thread John Hunter
On Feb 12, 2008 12:23 PM, Pierre GM [EMAIL PROTECTED] wrote:


 self.plot(current._dates-shift, current._series, lw=lw, ls=ls, c=c,
   scalex=False, scaley=False)
 self.highlightedline = len(self.lines)-1#
 return self.highlightedline

 As you see, I have an extra attribute (highlightedfreq) that stores the index
 of the highlighted line: when I need to deselect the highlighted curve, I
 just delete the corresponding element of the lines list.

I haven't tested this, but a more direct route may be (plot returns a
list of lines and the myline, idiom extracts the first element into
the variable myline)

  myline, = ax.plot(x, y, ...)

and then later when you want to remove:

  ax.lines.remove(myline)

Hope this helps,
JDH

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting from xemacs always 1 step behind

2008-02-12 Thread Phil Austin
John Hunter wrote:
 
  Well, the problem is that GTK, WX and Qt require threading support to
  use them properly interactively.  ipython has special modes for these
  to run the GUI mainloop in the separate thread.  tk is special in this
  regard, in that it runs from a standard python shell w/o threading
  support.  You may be able to configure ipython within xemacs to take
  advantage of both xemacs and ipython's support for interactive qt
  plotting in pylab.

FWIW, everything's working correctly for me using
xemacs + ipython:

Xemacs 21.5
current svn snapshot of python-mode.el from
   http://sourceforge.net/projects/python
current ipython svn snapshot
Centos 5.1 and python 2.5.1


 -- Phil


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] pyinstall and matplotlib

2008-02-12 Thread kc106_2005-matplotlib
Has anybody been able to create an exe of their python
applications involving matplotlib using pyinstall (ver
1.3)?  I am getting a:

 RuntimeError: Could not find the matplotlib data
files

when I attempt to run the exe created.

In searching the web, it appears this is an issue when
others tried to use py2exe as well.  Unfortunately,
the few hits I saw doesn't include enough details to
inspire me as to what I should be doing in my
pyinstall .spec file.

Does anybody has an example or information about this?

Thanks, 

--
John Henry

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] delete instance of axvspan

2008-02-12 Thread Michael Frauens
I am using span selector to identify an area and then highlight in in green.  I 
want the user to be able to validate this (or not) and then select another area 
(or not).  However, when the user selects the alternate area I want the 
previous instance of axvspan to be deleted/removed.  How do I remove this 
instance?  of do I have to delete the whole plot and replot?

Removing the instance is strongly preferred becauase the user may of altered 
the display using the canvas widgets.

 f=Figure(figsize=(12,8), dpi=72)
a=f.add_subplot(111)
...
a.plot(aTime, aDensity, 'k', aTime, aElec, 'b')
...
canvas = FigureCanvasTkAgg(f, master=root)
canvas.show()
canvas.get_tk_widget().pack(side=Tk.TOP)
.
def onselect(timemin,timemax):

indmin,indmax=npy.searchsorted(glbl.act_time[glbl.newjob],(timemin,timemax))
indmax=min(len(glbl.act_time[glbl.newjob])-1,indmax)
thistime=glbl.act_time[glbl.newjob][indmin:indmax]
exec(thisDens=glbl.%s_d[%d][indmin:indmax] % (newcolor, glbl.newjob))
exec(thisElect=glbl.%s_d[%d][indmin:indmax] % (newcolor, glbl.newjob))
print thisDens
#creates a reference green area to validate area chosen
lo=glbl.act_time[glbl.newjob][indmin]
hi=glbl.act_time[glbl.newjob][indmax]
a.axvspan(lo,hi,facecolor='g',alpha=0.5)
canvas.show()
...
span=SpanSelector(a,onselect,'horizontal',useblit=True,
  rectprops=dict(alpha=0.5,facecolor='red'))


  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] exceptions from easy_install matplotlib

2008-02-12 Thread Neal Becker
Should I be worried about these?

Installed 
/usr/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-linux-x86_64.egg
Processing dependencies for matplotlib
Finished processing dependencies for matplotlib
Exception exceptions.OSError: (2, 'No such file or
directory', 'src/image.cpp') in bound method CleanUpFile.__del__ of
setupext.CleanUpFile instance at 0xee08c0 ignored
Exception exceptions.OSError: (2, 'No such file or
directory', 'src/transforms.cpp') in bound method CleanUpFile.__del__ of
setupext.CleanUpFile instance at 0xedcc68 ignored
Exception exceptions.OSError: (2, 'No such file or
directory', 'src/backend_agg.cpp') in bound method CleanUpFile.__del__ of
setupext.CleanUpFile instance at 0xee0710 ignored


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap 0.9.9 ImportError

2008-02-12 Thread Jeff Whitaker
Ryan May wrote:
 Ryan:  Nothing comes immediately to mind - unless something went wrong 
 with your build.Could you rebuild basemap and send me the a log of 
 the build off-list?

 
 Attached.

 Ryan

   
Ryan:  Are you installing from source yourself, or building a patched 
version provided the Gentoo packaging system?

I suspect the latter, since I see

  Unpacking basemap-0.9.9.tar.gz to 
/var/tmp/portage/dev-python/basemap-0.9.9/work
 * Applying basemap-0.9.9-syslib.patch ...

at the beginning of the log.  Then later, the system proj4 lib (in 
/usr/lib64) is linked instead of the proj4 included in basemap.  This 
won't work, since the version of proj4 that I use includes some patches 
not in the released version.  Bottom line - the Gentoo basemap package 
is broken.

If you build it manually, outside the Gentoo packaging system, I'm 
betting it will work fine.

A Gentoo bug report might be in order, if you feel like submitting one.

-Jeff

-- 
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : [EMAIL PROTECTED]
325 BroadwayOffice : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting from xemacs always 1 step behind

2008-02-12 Thread John Hunter
On Feb 12, 2008 8:50 AM, Neal Becker [EMAIL PROTECTED] wrote:

 I did set interactive.

 I was using QtAgg.

 I hate tk.

[reposting in the correct thread]

Well, the problem is that GTK, WX and Qt require threading support to
use them properly interactively.  ipython has special modes for these
to run the GUI mainloop in the separate thread.  tk is special in this
regard, in that it runs from a standard python shell w/o threading
support.  You may be able to configure ipython within xemacs to take
advantage of both xemacs and ipython's support for interactive qt
plotting in pylab.

JDH

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] healpix and basemap

2008-02-12 Thread jlu
Has anyone had any luck plotting a Healpix (sky pixelization used in  
astronomy) map using matplotlib basemap... or any other python  
plotting package for that matter?

Cheers,
Jessica

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting from xemacs always 1 step behind

2008-02-12 Thread John Hunter
On Feb 12, 2008 6:49 AM, Neal Becker [EMAIL PROTECTED] wrote:
 This is a bit wierd.

 If running from xemacs, it seems interactive plotting is always 1 step
 behind.

I assume you have set 'interactive : True' in your rc file?  What
backend are you using (you should be using tkagg from xemacs) since it
does not require GUI threading support.

  http://matplotlib.sf.net/interactive.html

JDH

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting from xemacs always 1 step behind

2008-02-12 Thread Neal Becker
This is a bit wierd.

If running from xemacs, it seems interactive plotting is always 1 step
behind.

For example, I do:

M-x py-shell
This brings up a *Python* buffer in Comint mode running Ipython.

In [1]: from pylab import *

In [2]: plot ([1,2,3])
Out[2]: [matplotlib.lines.Line2D instance at 0xf563b0]

In [3]: xlabel('time')
Out[3]: matplotlib.text.Text instance at 0xf52758

In [4]: ylabel ('volts')
Out[4]: matplotlib.text.Text instance at 0xf533b0

When I execute step 3, the time is not show, but the line is.  When I do
step 4, now time is added.

Any clues?


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users