library(ggplot2)
ggplot(mpg, aes(x = displ, y = hwy)) + geom_point()

ggplot(mpg, aes(cty, hwy)) + geom_point()

ggplot(diamonds, aes(carat, price)) + geom_point()

ggplot(economics, aes(date, unemploy)) + geom_line()

ggplot(mpg, aes(cty)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(mpg, aes(displ, cty, colour = class)) + geom_point()

ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = "blue"))

ggplot(mpg, aes(displ, hwy)) + geom_point(colour = "blue")

ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(~class)

ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point() + facet_wrap(~class)

ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(span = 0.2)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(span = 1)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

#회기분석법 사용시 method = "lm" 사용
ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(method = "lm")
## `geom_smooth()` using formula 'y ~ x'
