#Data Visualization
#Histogrma, Box plot, Density, Polygon, Vioplot, Beanplot, Beesworm
y<-c(12,12,12,13,21,23,24,25,18,19,20,21)
hist(y)

boxplot(y)

plot(density(y))
polygon(density(y),col="green")

hist(y, col = "purple", xlab = "age", ylab = "weight", main = "Medical Statistics Group")

boxplot(y, col = "yellow", xlab = "age", ylab = "weight", main = "Medical Statistics Group")

#New Windows
# 1. Basic Histogram
windows(); hist(y)
# 2. Basic Boxplot
windows(); boxplot(y)
# 3. Density Plot
windows(); plot(density(y))
# 4. Filled Density Plot (Polygon needs a plot frame first)
windows(); plot(density(y), main="Green Density Plot")
polygon(density(y), col="green")
# 5. Styled Histogram
windows(); hist(y, col = "purple", xlab = "Age", ylab = "Frequency", main = "Medical Statistics Group")
# 6. Styled Boxplot
windows(); boxplot(y, col = "yellow", ylab = "Age", main = "Medical Statistics Group")
# 1. Open the plotting window
windows()
# 2. Create the base density plot (The "Canvas")
plot(density(y), col = "green", xlab = "Age", ylab = "Density", main = "Medical Statistical Group")
# 3. Add the filled polygon on top of the existing plot
polygon(density(y), col = "blue", border = "black")