datS$type <- 'synapse'
datNS$type <- 'non-synapse'
tmp1 <- melt(datS[, .(psd95, synapsin, type)], id.vars = c('psd95', 'synapsin', 'type'))
tmp2 <- melt(datNS[, .(psd95, synapsin, type)], id.vars = c('psd95', 'synapsin', 'type'))
dat <- as.data.table(rbind(tmp1, tmp2))
p1 <- ggplot(data = dat, aes(x = psd95, y = ..density.., color = type)) + geom_density()
p12 <- ggplot(data = dat, aes(x = psd95, color = type, fill = type)) +
geom_histogram(position = 'identity', alpha = 0.25, bins = 100)
p2 <- ggplot(data = dat, aes(x = synapsin, y = ..density.., color = type)) + geom_density()
p22 <- ggplot(data = dat, aes(x = synapsin, color = type, fill = type)) +
geom_histogram(position = 'identity', alpha = 0.25, bins = 100)
PSD95
grid.arrange(p1, p12)
SYNAPSIN
grid.arrange(p2, p22)