csv - creating heatmap with R with eye-tracker data -


i have table composed following data

frame,x,y 

which resulting data several eye tracking analysis. create heatmap using r, following enter image description here

i tried several script found online, none of them gave me result.

how can do?


here sample data ignore first 2 columns

task,visualization,frame,x,y 1,b,1,383,221 1,b,1,632,356 1,b,1,947,663 1,b,1,546,206 1,b,1,488,272     1,b,1,578,752 1,b,1,415,261 1,b,1,693,158 1,b,1,684,528 1,b,1,592,67 1,b,1,393,180 1,b,1,1033,709 1,b,1,1080,739 1,b,1,711,523 1,b,1,1246,49 1,b,1,742,69 1,b,1,601,370 1,b,10,902,684 1,b,10,517,241 1,b,10,583,86 1,b,10,582,754 1,b,10,426,257 1,b,10,575,229 1,b,10,697,150 1,b,10,379,520 1,b,10,390,286 1,b,10,618,396 1,b,10,710,143 1,b,10,383,188 1,b,10,1026,713 1,b,10,1078,625 1,b,10,713,521 

you can type of plot quite using stat_bin2d ggplot2:

library(ggplot2) ggplot(dat, aes(x = x, y = y)) + stat_bin2d(bins = 10) 

enter image description here

this simple binning, @romanlustrik suggested perform kind of kernel smoothing. can done using ggplot2:

ggplot(dat, aes(x = x, y = y)) +   stat_density2d(geom = "tile", aes(fill = ..density..), contour = false) +   geom_point() 

enter image description here note dat example data gave, geting data data.frame:

dat = read.table(textconnection("task,visualization,frame,x,y     1,b,1,383,221     1,b,1,632,356     1,b,1,947,663     1,b,1,546,206     1,b,1,488,272         1,b,1,578,752     1,b,1,415,261     1,b,1,693,158     1,b,1,684,528     1,b,1,592,67     1,b,1,393,180     1,b,1,1033,709     1,b,1,1080,739     1,b,1,711,523     1,b,1,1246,49     1,b,1,742,69     1,b,1,601,370     1,b,10,902,684     1,b,10,517,241     1,b,10,583,86     1,b,10,582,754     1,b,10,426,257     1,b,10,575,229     1,b,10,697,150     1,b,10,379,520     1,b,10,390,286     1,b,10,618,396     1,b,10,710,143     1,b,10,383,188     1,b,10,1026,713     1,b,10,1078,625     1,b,10,713,521"), header = true, sep = ",") 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -