Professional Documents
Culture Documents
Ggplot en Datacam1
Ggplot en Datacam1
Ggplot en Datacam1
head(economics)
geom_line()
# Expand the following command with geom_rect() to draw the recess periods
geom_rect(data = recess,
geom_line()
str(fish.species)
# Use gather to go from fish.species to fish.tidy
geom_line()
# Using ggplot:
geom_point()
# Using qplot:
qplot(wt, mpg, data = mtcars)
# Categorical:
# cyl
# gear
# Continuous
# hp
# qsec
qplot(wt, mpg, data = mtcars, color = qsec)
class(mtcars$cyl)
class(mtcars$am)
class(mtcars$wt)
qplot(
cyl, wt,
data = mtcars,
fill = am,
geom = "dotplot",
binaxis = "y",
stackdir = "center"
)
# ChickWeight is available in your workspace
head(ChickWeight)
geom_line(aes(group = Chick))
geom_line(aes(group = Chick))
geom_smooth(lwd = 2, se = FALSE)
# titanic is available in your workspace
str(titanic)
geom_bar(position = "dodge")
geom_bar(position = "dodge") +
facet_grid(. ~ Survived)
facet_grid(. ~ Survived)