my site: https://b04902122.github.io/CSX_R/week_3/ggplot2.html
library(ggplot2)
ggplot(data=iris, aes(x=Species, y=Sepal.Length, fill=Species)) +
geom_bar(stat="identity") +
guides(fill=FALSE)
ggplot(data = iris,
aes(x = factor(""), fill = Species) ) +
geom_bar() +
coord_polar(theta = "y") +
scale_x_discrete("")
ggplot(iris, aes(Sepal.Length, Sepal.Width, color=Species)) +
geom_point()
ggplot(data=iris,aes(x=Sepal.Width, y=Sepal.Length,color=Species)) + geom_point() +geom_smooth(se=FALSE)+
theme_minimal()
## `geom_smooth()` using method = 'loess'
ggplot(iris, aes(Sepal.Length, Sepal.Width, color=Species)) +
geom_line()
ggplot(data = iris, aes(x = Sepal.Length,color=Species)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplot(iris, aes(x=Petal.Length, color=Species)) +
geom_freqpoly()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplot(iris, aes(x=Petal.Length, y=Petal.Width, color=Species)) +
geom_boxplot()
## Warning: position_dodge requires non-overlapping x intervals
ggplot(data=iris,aes(x=Sepal.Length,color=Species)) + geom_density() +theme_minimal()
ggplot(data=iris,aes(x=Petal.Width,y=Petal.Length,color=Species)) +geom_density2d()+ theme_minimal()