ginput() equivalent?

Is there a simple way to grab x,y coordinates from active plot in a
manner similar to using matlab's ginput() function?

Thanks in advance,
-M.

My setup:
WxAgg backend
Matplotlib-0.74

···

-----Original Message-----
From: matplotlib-users-admin@lists.sourceforge.net
[mailto:matplotlib-users-admin@lists.sourceforge.net] On Behalf Of
matplotlib-users-request@lists.sourceforge.net
Sent: Thursday, April 07, 2005 8:19 PM
To: matplotlib-users@lists.sourceforge.net
Subject: Matplotlib-users digest, Vol 1 #550 - 11 msgs

Send Matplotlib-users mailing list submissions to
  matplotlib-users@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
  matplotlib-users List Signup and Options
or, via email, send a message with subject or body 'help' to
  matplotlib-users-request@lists.sourceforge.net

You can reach the person managing the list at
  matplotlib-users-admin@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific than
"Re: Contents of Matplotlib-users digest..."

Today's Topics:

   1. Re: Using RendererAgg with windows (jim)
   2. Re: Using RendererAgg with windows (John Hunter)
   3. py2exe Problems... (andrea_gavana@...517...)
   4. problems with py2exe (oliver.tomic@...507...)
   5. imshow axis directions (Stephen Walton)
   6. Re: imshow axis directions (Perry Greenfield)
   7. Re: imshow axis directions (John Hunter)
   8. feature request (Rich Drewes)
   9. Re: imshow axis directions (Stephen Walton)
  10. Re: imshow axis directions (Robert Kern)
  11. Re: imshow axis directions (Stephen Walton)

--__--__--

Message: 1
From: jim <jlh@...557...>
To: John Hunter <jdhunter@...4...>
Subject: Re: [Matplotlib-users] Using RendererAgg with windows
Date: Thu, 7 Apr 2005 03:29:12 +0000
Cc: matplotlib-users@lists.sourceforge.net

John:

What I need to do is create drawings of windows (as in plug holes in
houses and let in light) with grid and other options on the fly.

So what I need are the graphic primitives -- canvas, lines, fills ...
The output needs to be a graphic file.

I will go back and study the docs, but a suggestion of what area to use
would be most welcome. Or, of course, a different module than
matplotlib if that would be more appropriate.

Thanks,
Jim

On Wednesday 06 April 2005 08:13 pm, you wrote:

    > Running this script gives the results below #! /usr/bin/env
    > python

    > from matplotlib.backends.backend_agg import RendererAgg from
    > matplotlib.transforms import Value

I know there are examples in the pdf user's guide discussing how to
use the backend renderer directly, and these are meant mostly to be
helpful to matplotlib developers. Unfortunately, the guide has lagged

behind the current development state. The backend renderer API is in
a transition state right now as we try to introduce some new methods
to solve some old problems. In particular, the draw_lines method that

you are experiencing problems with has recently had a change in its
call signature.

These changes have been discussed at some length recently on the
matplotlib-devel list. If you are interested, you might want to
browse the matplotlib-devel archives and/or join the mailing list; see

for example

http://sourceforge.net/mailarchive/forum.php?thread_id=6938045&forum_id=
36187 .

Thanks for reporting this discrepancy -- in the near term the backend
API shouldn't be used on the user side. If there is something you
want to do but can't in the current API let me know.

As for the platform specific differences you report, my first guess is

that the matplotlib versions may not be the same. I wouldn't expect
platform specific differences in the backend API for the same version.

JDH

--__--__--

Message: 2
To: jim <jlh@...557...>
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Using RendererAgg with windows
From: John Hunter <jdhunter@...4...>
Date: Wed, 06 Apr 2005 22:47:56 -0500

    > John: What I need to do is create drawings of windows (as in
    > plug holes in houses and let in light) with grid and other
    > options on the fly.

    > So what I need are the graphic primitives -- canvas, lines,
    > fills ... The output needs to be a graphic file.

You probably want to be using matplotlib primitives. Assuming you have
a matplotlib.axes.Axes (or Subplot) instance stored as "ax", The
primitives are

  matplotlib.lines.Line2D - add with ax.add_line
  matplotlib.patches.Rectangle - add with ax.add_patch
  matplotlib.patches.Polygon - add with ax.add_patch
  matplotlib.patches.RegularPolygon - add with ax.add_patch
  matplotlib.patches.Circle - add with ax.add_patch
  matplotlib.patches.Text - add with ax.add_artist

Ie, there are not too many mpl primitives, and using these will insulate
you from changes in the mpl backend (renderer) api. The backend API is
meant only for mpl developers. The classes referred to above are all
part of the matplotlib Artist hierarchy.

    > I will go back and study the docs, but a suggestion of what
    > area to use would be most welcome. Or, of course, a
    > different module than matplotlib if that would be more
    > appropriate.

To reiterate, there is one base class matplotlib.artist.Artist that all
the objects that render into the figure derive from. From this, there
are just a few derived classes to be aware of: Line2D, Patch, Text, and
Collection. From these there are a few more derived classes (eg Patch
and Collection have some specialized derived classes, Line2D and Text do
not as of yet). Other Artists (including Figure, Axes, Legend, Table
and so on) are simply composites of these primitive types. See the
following class docs for more info:

  http://matplotlib.sourceforge.net/matplotlib.artist.html
  http://matplotlib.sourceforge.net/matplotlib.lines.html
  http://matplotlib.sourceforge.net/matplotlib.patches.html
  http://matplotlib.sourceforge.net/matplotlib.text.html
  http://matplotlib.sourceforge.net/matplotlib.collections.html

In short, you should concentrate on building the primitive types you
need rather than calling the renderer methods directly. The primitives
will call the right renderer methods as necessary (as they do in
matplotlib.lines, for example).

Hope this helps,
JDH

--__--__--

Message: 3
Date: Thu, 7 Apr 2005 11:03:38 +0200
From: andrea_gavana@...517...
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] py2exe Problems...

Hello NG,

    this morning I have done the really BIG mistake of uninstalling the
following things:

- Numeric 23.5
- ctypes 0.9.2
- numarray 1.1.1
- Matplotlib 0.72

And I have installed the following:

- Numeric 23.8
- ctypes 0.9.6
- numarray 1.2.3
- Matplotlib 0.74

Using py2exe 0.5.4, now I get some errors on not-found modules, that I
pu= t at the end of the mail. I have never encountered these problems
with olde= r versions of the aforementioned tools. Please note that, a
part the VTK th= ings, almost all the missing modules are from
numerix/backends. If I try to sta= rt the application, I get a Visual
C++ runtime error (and not the usual MYEX= E.exe.log message from
py2exe, so I do not know how to track the error).
I am on a Windows 2000 machine.
Deinstalling the new tools and re-installing the old ones didn't help
any= more...

Does anyone have a suggestion?

['backends.draw_if_interactive', 'backends.new_figure_manager',
'backends= .show', 'cephes', 'dl', 'libvtkCommonPython',
'libvtkFilteringPython', 'libvtkGr= aphicsP ython',
'libvtkHybridPython', 'libvtkIOPython', 'libvtkImagingPython', 'l=
ibvtkPa rallelPython', 'libvtkPatentedPython', 'libvtkRenderingPython',
'numerix.= ArrayTy pe', 'numerix.Complex', 'numerix.Complex32',
'numerix.Complex64', 'numeri= x.Float ', 'numerix.Float32',
'numerix.Float64', 'numerix.Int', 'numerix.Int16', 'numeri x.Int32',
'numerix.Int8', 'numerix.Matrix', 'numerix.UInt16', 'numerix.UI= nt32',
'numerix.UInt8', 'numerix.absolute', 'numerix.add', 'numerix.allclose',
'numerix .alltrue', 'numerix.arange', 'numerix.arccos',
'numerix.arccosh', 'numeri= x.arcsi n', 'numerix.arcsinh',
'numerix.arctan', 'numerix.arctan2', 'numerix.arct= anh', '
numerix.argmax', 'numerix.argmin', 'numerix.argsort', 'numerix.around',
'numerix .array', 'numerix.arrayrange', 'numerix.asarray',
'numerix.asum', 'numeri= x.bitwi se_and', 'numerix.bitwise_or',
'numerix.bitwise_xor', 'numerix.ceil', 'nu= merix.c hoose',
'numerix.clip', 'numerix.compress', 'numerix.concatenate', 'numer=
ix.conj ugate', 'numerix.convolve', 'numerix.cos', 'numerix.cosh',
'numerix.cross= _correl ate', 'numerix.cumproduct', 'numerix.cumsum',
'numerix.diagonal', 'numeri= x.divid e', 'numerix.dot', 'numerix.equal',
'numerix.exp', 'numerix.fabs', 'numer= ix.fft.
fft', 'numerix.floor', 'numerix.fmod', 'numerix.fromfunction',
'numerix.f= romstri ng', 'numerix.greater', 'numerix.greater_equal',
'numerix.hypot', 'numeri= x.ident ity', 'numerix.indices',
'numerix.innerproduct', 'numerix.less', 'numerix= .less_e qual',
'numerix.log', 'numerix.log10', 'numerix.logical_and', 'numerix.lo=
gical_n ot', 'numerix.logical_or', 'numerix.logical_xor',
'numerix.matrixmultiply= ', 'num erix.maximum', 'numerix.minimum',
'numerix.mlab.amax', 'numerix.mlab.amin= ', 'num erix.mlab.cov',
'numerix.mlab.diff', 'numerix.mlab.flipud', 'numerix.mlab= .hannin g',
'numerix.mlab.rand', 'numerix.mlab.std', 'numerix.mlab.svd', 'numerix=
.multip ly', 'numerix.negative', 'numerix.nonzero', 'numerix.not_equal',
'numerix= .nx', '
numerix.ones', 'numerix.outerproduct', 'numerix.pi', 'numerix.power',
'nu= merix.p roduct', 'numerix.put', 'numerix.putmask', 'numerix.rank',
'numerix.ravel= ', 'num erix.repeat', 'numerix.reshape',
'numerix.resize', 'numerix.searchsorted'= , 'nume rix.shape',
'numerix.sin', 'numerix.sinh', 'numerix.size', 'numerix.somet= rue', '
numerix.sort', 'numerix.sqrt', 'numerix.subtract', 'numerix.swapaxes',
'n= umerix.
take', 'numerix.tan', 'numerix.tanh', 'numerix.trace',
'numerix.transpose= ', 'num erix.where', 'numerix.which',
'numerix.zeros', 'vtkParallelPython', 'matp= lotlib.
numerix.absolute', 'matplotlib.numerix.equal', 'numarray.Complex',
'numar= ray.Com plex32', 'numarray.Complex64', 'numarray.Float',
'numarray.Float32', 'num= array.F loat64', 'numarray.Int',
'numarray.Int16', 'numarray.Int32', 'numarray.In= t8', 'n
umarray.NumArray', 'numarray.UInt16', 'numarray.UInt32',
'numarray.UInt8'= , 'numa rray._dotblas', 'numarray.asarray',
'numarray.dot', 'numarray.fromlist', 'numarr ay.shape',
'numarray.typecode', 'numarray.zeros', 'wx.BitmapFromImage', 'wx.Empt
yIcon']

--__--__--

Message: 4
To: matplotlib-users@lists.sourceforge.net
From: oliver.tomic@...507...
Date: Thu, 7 Apr 2005 11:27:43 +0200
Subject: [Matplotlib-users] problems with py2exe

Hi,

I have some problems compiling an .exe-file for my application. I use
wxPython together with matplotlib and tried to make an .exe-file with
both packages for the first time.

Windows XP
Python 2.4
wxPython 2.5.3.1
matplotlib 0.74

I checked the FAQ at the matplotlib homepage and the py2exe-examples and
did the following:

from distutils.core import setup
import glob
import py2exe

data = glob.glob(r'C:\Python24\Lib\site-packages\matplotlib\*')
data.append(r'C:\Python24\Lib\site-packages\matplotlib\.matplotlibrc')

setup(
    console = ["PanelCheck.py"],
    data_files = [("matplotlibdata", data)],
    )

After py2exe is finished I find both folders 'dist' and 'build' as
ususal, however I can't finde an .exe-file of my application
PanelCheck.py in the dist-folder.
I assume that 'window' is what I want to use in the code above, but when
I do that I get the following error:

--(just a small part of the console output)--
error: can't copy 'C:\Python24\Lib\site-packages\matplotlib\backends':
doesn't exist or not a regular file

What am I doing wrong? Help is really appreciated!

Oliver

--__--__--

Message: 5
Date: Thu, 07 Apr 2005 11:08:01 -0700
From: Stephen Walton <stephen.walton@...267...>
To: matplotlib-users <matplotlib-users@lists.sourceforge.net>
Subject: [Matplotlib-users] imshow axis directions

Hi,

I was just comparing images displayed with imshow() with what I get from
IRAF's display command and ds9. The latter puts the first axis
increasing horizontally and the second axis increasing vertically, as if
the image array were addressed as img[ix,iy], where ix and iy are
integer x and y coordinates. The axes imshow() produces are labeled as
if this is true for it as well, but in fact the image is upside down
with respect to what I see with IRAF. Even odder, to see the same
display I see in IRAF I have to do imshow(img[::-1,:]), as if I'm
reversing the direction of the first axis.

I've tried to look at the source, really, but I feel like I'm *years*
away from being enough of a Python hacker to understand matplotlib.

Steve

--__--__--

Message: 6
Cc: matplotlib-users <matplotlib-users@lists.sourceforge.net>,
        Perry Greenfield <perry@...86...>
From: Perry Greenfield <perry@...86...>
Subject: Re: [Matplotlib-users] imshow axis directions
Date: Thu, 7 Apr 2005 14:12:16 -0400
To: Stephen Walton <stephen.walton@...267...>

check out the .matplotlibrc image.origin configuration parameter. The
default is to have pixel 0,0 on the upper left which is opposite of what
us weird astronomers think is the natural locationl

Perry

On Apr 7, 2005, at 2:08 PM, Stephen Walton wrote:

Hi,

I was just comparing images displayed with imshow() with what I get
from IRAF's display command and ds9. The latter puts the first axis
increasing horizontally and the second axis increasing vertically, as
if the image array were addressed as img[ix,iy], where ix and iy are
integer x and y coordinates. The axes imshow() produces are labeled
as if this is true for it as well, but in fact the image is upside
down with respect to what I see with IRAF. Even odder, to see the
same display I see in IRAF I have to do imshow(img[::-1,:]), as if I'm

reversing the direction of the first axis.

I've tried to look at the source, really, but I feel like I'm *years*
away from being enough of a Python hacker to understand matplotlib.

Steve

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide Read honest & candid
reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--__--__--

Message: 7
To: Stephen Walton <stephen.walton@...267...>
Cc: matplotlib-users <matplotlib-users@lists.sourceforge.net>
Subject: Re: [Matplotlib-users] imshow axis directions
From: John Hunter <jdhunter@...4...>
Date: Thu, 07 Apr 2005 13:15:35 -0500

    > Hi, I was just comparing images displayed with imshow()
    > with what I get from IRAF's display command and ds9. The
    > latter puts the first axis increasing horizontally and
    > the second axis increasing vertically, as if the image
    > array were addressed as img[ix,iy], where ix and iy are
    > integer x and y coordinates. The axes imshow() produces
    > are labeled as if this is true for it as well, but in
    > fact the image is upside down with respect to what I see
    > with IRAF. Even odder, to see the same display I see in
    > IRAF I have to do imshow(img[::-1,:]), as if I'm
    > reversing the direction of the first axis.

Does changing the rc param

  image.origin : upper # lower | upper

to lower help?

    > I've tried to look at the source, really, but I feel like
    > I'm *years* away from being enough of a Python hacker to
    > understand matplotlib.

Hmm, the code's not that bad is it :slight_smile:

JDH

--__--__--

Message: 8
Date: Thu, 7 Apr 2005 11:51:37 -0700 (PDT)
From: Rich Drewes <drewes@...395...>
To: matplotlib-users <matplotlib-users@lists.sourceforge.net>
Subject: [Matplotlib-users] feature request

Some ability to specify empty space between subplots would be very
convenient. I'm not sure if this could best be done at figure creation
or at subplot creation with an additional argument that says how much
space to leave above or below.

The motivation is that creating subplots with separate titles is a very
common desire, and doing so now results in title text that invariably
overlaps the plot above (or if the font is reduced enough, it may fit
but looks squished in there).

Using manual axes creation is another approach that has been suggested,
but this is a pain and seems to obviate the convenience of subplot().

If there is a better approach than creating custom axes, I'd love to
hear about it.

Thanks to all the pylab developers!

Rich

--__--__--

Message: 9
Date: Thu, 07 Apr 2005 12:00:27 -0700
From: Stephen Walton <stephen.walton@...267...>
To: John Hunter <jdhunter@...8...>
CC: matplotlib-users <matplotlib-users@lists.sourceforge.net>
Subject: Re: [Matplotlib-users] imshow axis directions

John Hunter wrote:

"Stephen" == Stephen Walton <stephen.walton@...267...> writes:
           

Does changing the rc param

image.origin : upper # lower | upper

to lower help?

Yes, it makes the image the right way around. I was simply confused
because I expected the pixel at (x,y) in the imshow display to be the
value of img[x,y]. It appears not to be. I hasten to add MATLAB's
worse, as the pixel at (x,y) is actually the value of img[y,x]; MATLAB
displays with the first array coordinate increasing downward and the
second from left to right.

   > I've tried to look at the source, really, but I feel like
   > I'm *years* away from being enough of a Python hacker to
   > understand matplotlib.

Hmm, the code's not that bad is it :slight_smile:

I'm sure the code is fine, John, and it's just me. Specifically, if I
want to see how matplotlib is doing something, I can't just trace
function calls like I'm used to doing with Fortran and C, because there
are methods too and I have to find the class which defines those methods
to see what's happening. Is there anything like ctags for Python?

Steve

--__--__--

Message: 10
Date: Thu, 07 Apr 2005 14:35:11 -0700
From: Robert Kern <rkern@...376...>
Organization: The Church of Last Thrusday
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] imshow axis directions

Stephen Walton wrote:

I'm sure the code is fine, John, and it's just me. Specifically, if I

want to see how matplotlib is doing something, I can't just trace
function calls like I'm used to doing with Fortran and C, because
there are methods too and I have to find the class which defines those

methods to see what's happening. Is there anything like ctags for

Python?

Exuberant ctags

--
Robert Kern
rkern@...376...

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

--__--__--

Message: 11
Date: Thu, 07 Apr 2005 16:03:17 -0700
From: Stephen Walton <stephen.walton@...267...>
To: Robert Kern <rkern@...376...>
CC: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] imshow axis directions

Robert Kern wrote:

Exuberant ctags

http://ctags.sourceforge.net/

Which, as it turns out, is the version of ctags on Fedora Core 3. I did
a 'ctags -R' in the matplotlib root directory and am now happily
browsing the source using nedit.

Thanks, Robert!

Steve

--__--__--

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net

End of Matplotlib-users Digest