> 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

-------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to