scatter plot onto background image

Hi, Everyone,

I want to create a scatter plot onto a background image. Anybody could help me?Thank you!

The background.PNG is shown full screen with a resolution of 1024*768. The data in the fixation_xy.txt is the coordinates of eye-movement data, first column for X axis, second column for Y axis. I wish to do a scatter plot with the data onto background.PNG. Please give me a helping hand how could I do this with matplotlib.

Thank you !

Jibo

fixation_xy.txt (107 Bytes)

background.PNG

···


Best Regards,

     He Jibo
   jibohe2@...1875...

hejibo@…287…


He Jibo
Department of Psychology,
Beckman Institute for Advanced Science and Technology
University of Illinois, Urbana Champaign,
603 East Daniel St.,
Champaign, IL 61820

Tel: 217-244-4461(office)
217-244-6763(lab)
Email: hejibo@…287…

The background.PNG is shown full screen with a resolution of 1024*768. The
data in the fixation_xy.txt is the coordinates of eye-movement data, first
column for X axis, second column for Y axis. I wish to do a scatter plot
with the data onto background.PNG. Please give me a helping hand how could I
do this with matplotlib.

!! I am assuming xy-fixation (screen coordinates) values are given
with respect to a a lower left origin. (see line [*] in code)

import pylab as p

im_fn = "background.PNG"
xy_fn = "fixation_xy.txt"
s = 100 # marker size
c = 'r' # marker color
marker = 's' # marker type

im = p.imread(im_fn)
xy = p.loadtxt(xy_fn)
xy_normed = xy/[[1024./im.shape[1], 768./im.shape[0]]]

p.imshow(im, origin='lower') # [*]
p.scatter(xy_normed[:,0], xy_normed[:,1], s=s, c=c, marker=marker)
p.show()

Arnar

Hi Jibo,

I'm not sure of your reasons for wanting to do this, but you might find
the psychopy package of interest:
http://www.psychopy.org/

Gary R.

He Jibo wrote:

···

Hi, Everyone,

I want to create a scatter plot onto a background image. Anybody could
help me?Thank you!

The background.PNG is shown full screen with a resolution of 1024*768.
The data in the fixation_xy.txt is the coordinates of eye-movement data,
first column for X axis, second column for Y axis. I wish to do a
scatter plot with the data onto background.PNG. Please give me a helping
hand how could I do this with matplotlib.

Thank you !

Jibo

--
Best Regards,

     He Jibo
   jibohe2@\.\.\.1875\.\.\. 

<mailto:jibohe2@…1875…>
hejibo@...287... <mailto:hejibo@…287…>

2008/2/9 He Jibo <hejibo@...287...>:

Hi, Everyone,

I want to create a scatter plot onto a background image. Anybody could help
me?Thank you!

The mri_demo.py example in the matplotlib/examples in the src
distribution illustrates this.

Sorry -- wrong example. The example I was thinking of is
examples/image_demo2.py, also at

http://matplotlib.sf.net/examples/image_demo2.py

but if you want to run it you will need to get the matplotlib src
directory which also has the data file for the CT image

JDH

···

On Feb 10, 2008 9:43 AM, John Hunter <jdh2358@...287...> wrote:

> I want to create a scatter plot onto a background image. Anybody could help
> me?Thank you!

The mri_demo.py example in the matplotlib/examples in the src
distribution illustrates this.

Hello all,

Could someone offer suggestions for (preferably) python code to compute:

  • day/night terminator position
  • solar zenith angle

I’m developing a basemap application that is required to hide contour
data in the night regions of the earth.

The projections will be Mercator and polar stereographic; presumably,
it will suffice to have Mercator-based terminator map only.

Thanks for any suggestions.

– jv

Jim Vickroy wrote:

Hello all,

Could someone offer suggestions for (preferably) python code to compute:

    * day/night terminator position
    * solar zenith angle

I'm developing a basemap application that is required to hide contour
data in the night regions of the earth.

The projections will be Mercator and polar stereographic; presumably,
it will suffice to have Mercator-based terminator map only.

Thanks for any suggestions.

-- jv

Jim: I was googling around and found this python code:

https://garage.maemo.org/plugins/scmsvn/viewcvs.php/trunk/mclock-src/usr/lib/mClock/sun.py?root=mclock&rev=2&view=markup

and this IDL code (which should be straightforward to convert to python):

http://www.dfanning.com/programs/terminator_map.pro

HTH,

-Jeff

P.S: I'd love to see what you come up with, so drop by sometime (it
seems we're in the same building!)

···

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

Jeff Whitaker wrote:

Jim: I was googling around and found this python code:

Do be careful way up North or Down south -- some Sunrise/set code chokes when the sun does not ever rise or set at a given location on a given day. A quick glance at that code looked like it may not handle that.

There is some nice code in the JavaScript on this page:

http://www.srrb.noaa.gov/highlights/sunrise/sunrise.html

It looks to me like it was translated from C, but the webmaster said not.

I've got it partly converted to Python, enclosed. If you finish it (and better yet, test it!), please let me know.

-Chris

sunrise.py (68.5 KB)

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Christopher Barker wrote:

Jeff Whitaker wrote:

Jim: I was googling around and found this python code:

Do be careful way up North or Down south -- some Sunrise/set code chokes when the sun does not ever rise or set at a given location on a given day. A quick glance at that code looked like it may not handle that.

There is some nice code in the JavaScript on this page:

NOAA Improved Sunrise/Sunset Calculation

It looks to me like it was translated from C, but the webmaster said not.

I've got it partly converted to Python, enclosed. If you finish it (and better yet, test it!), please let me know.

-Chris

Thanks for the warning Chris and also thanks for the code. I will take a look at it and if I finish/test it, I will certainly let you know.

Thanks again,
-- jv