 hermesh2
10/18/2015 - 9:48 PM

## Blog 2015.10.18 Create Data and plot happy.R

``````img <- readJPEG(source =  "happy face.jpg")
# Transform
g <- rasterGrob(image = img, interpolate=TRUE)

# create data 1 per ROI
noise_mean <- 0
noise_sd <- 10e-2 * .5

RightEye_n <- 200 + 2 + 25
RightEye_x <- 0.25 + rnorm(n = RightEye_n,mean = noise_mean, sd = noise_sd )
RightEye_y <- 0.65 + rnorm(n = RightEye_n,mean = noise_mean, sd = noise_sd )

LeftEye_n <- 200 + 2 + 25
LeftEye_x <- 0.45 + rnorm(n = LeftEye_n,mean = noise_mean, sd = noise_sd )
LeftEye_y <- 0.70 + rnorm(n = LeftEye_n,mean = noise_mean, sd = noise_sd )

Mouth_n <- 150 + 4 - 50
Mouth_x <- 0.4 + rnorm(n = Mouth_n, mean = noise_mean, sd = noise_sd )
Mouth_y <- 0.45 + rnorm(n = Mouth_n,mean = noise_mean, sd = noise_sd )

Nouse_n <- 100 + 10
Nouse_x <- 0.38 + rnorm(n = Mouth_n, mean = noise_mean, sd = noise_sd )
Nouse_y <- 0.55 + rnorm(n = Mouth_n,mean = noise_mean, sd = noise_sd )

Noise_n <- 20
Noise_x <- seq(from = 0.38,  to = 1, length.out = Noise_n) +
rnorm(n = Noise_n , mean = noise_mean, sd = noise_sd )
Noise_y <-
seq(from = 0.55,to =  1, length.out = Noise_n) +
rnorm(n = Noise_n , mean = noise_mean, sd = noise_sd )

x <- c(RightEye_x, Mouth_x, Nouse_x, LeftEye_x , Noise_x)
y <- c(RightEye_y, Mouth_y, Nouse_y, LeftEye_y , Noise_y)

a <- data.table(x,y)
summary(a)
data2 <- a

jpeg(filename = "disgust with density plot.jpeg", res = 100,
width = 18, height =10 ,units =  "cm")
print(p)
dev.off()``````