### Histogram with superimposed normal curve (three different color examples)

h1 <- hist(dat1$V1, breaks = 24, density = 100,
col = "red", xlab = "V1", main = "Histogram of V1")
xfit1 <- seq(min(dat1$V1), max(dat1$V1), length = 40)
yfit1 <- dnorm(xfit1, mean = mean(dat1$V1), sd = sd(dat1$V1))
yfit1 <- yfit1 * diff(h1$mids[1:2]) * length(dat1$V1)
lines(xfit1, yfit1, col = "black", lwd = 2)

h2 <- hist(dat1$V2, breaks = 24, density = 100,
col = "green", xlab = "V2", main = "Histogram of V2")
xfit2 <- seq(min(dat1$V2), max(dat1$V2), length = 40)
yfit2 <- dnorm(xfit2, mean = mean(dat1$V2), sd = sd(dat1$V2))
yfit2 <- yfit2 * diff(h2$mids[1:2]) * length(dat1$V2)
lines(xfit2, yfit2, col = "black", lwd = 2)


h3 <- hist(dat1$V3, breaks = 24, density = 100,
col = "blue", xlab = "V3", main = "Histogram of V3")
xfit3 <- seq(min(dat1$V3), max(dat1$V3), length = 40)
yfit3 <- dnorm(xfit3, mean = mean(dat1$V3), sd = sd(dat1$V3))
yfit3 <- yfit3 * diff(h3$mids[1:2]) * length(dat1$V3)
lines(xfit3, yfit3, col = "black", lwd = 2)