
I plot this histogram using the R code hist(redwine$quality) I wanted to make it seems more like a normal distribution plot :(

I plot this histogram using the R code hist(redwine$quality) I wanted to make it seems more like a normal distribution plot :(
The problem is that your data are not continuous. "Sturges", the default method of calculating the "optimal" number of break-points (ceiling(1 + log2(n))), and therefore the break-points, often fails for discrete data.
vals <- 3:8
times <- c(20,100,690,650,200,30)
quality <- unlist(lapply(seq_along(vals), function(i) rep(vals[i], times=times[i])))
h1 <- hist(quality)
h1$breaks
#[1] 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0
Solution: Specify a vector for the breaks argument.
hist(quality, breaks=2:8)
Or use a barplot.
barplot(table(quality))
 
    
    You can reduce the number of breaks.
hist(iris$Petal.Length, breaks=4)
You can also add a curve but keep the original breaks.
hist(iris$Petal.Length, freq=FALSE)
curve(dnorm(x, mean=mean(iris$Petal.Length), sd=sd(iris$Petal.Length)), add=TRUE, col="red")
