Академический Документы
Профессиональный Документы
Культура Документы
###################################################################################
###################################################################################
#########################
# Map cyl to size
ggplot(mtcars, aes(x = wt, y = mpg, size = cyl )) + geom_point()
###################################################################################
###################################################################################
#############################
#gr�fico de barras
cyl.am <- ggplot(mtcars, aes(x = factor(cyl), fill = factor(am)))
cyl.am +
geom_bar(position = "stack" ou "fill" ou "dodge")
#histograma
ggplot(dataset, aes(qualquer coisa)) +
geom_histogram()
#by deafult, goem_histogram(count), mas pode colocar bindwidth, aes(y = ???),
bindwidth = 1, fill = "alguma cor(?)"
#Uma forma de overlap
ggplot(mtcars, aes(x = cyl, fill = am)) +
geom_bar(position = posn_d, alpha = 0.6)
#Time-series
ggplot(economics, aes(x = date, y = unemploy)) +
geom_line()
#Time-series com recess�o
ggplot(economics, aes(x = date, y = unemploy/pop)) +
geom_rect(data = recess, aes(xmin = begin, xmax = end, ymin = -Inf, ymax = +Inf),
inherit.aes = FALSE,
fill = "red", alpha = 0.2) +
geom_line()
#Multiple Time-Series
str(fish.species)
fish.tidy <- gather(fish.species, Species, Capture, -Year)
ggplot(fish.tidy, aes(x = Year, y = Capture, color = Species)) + geom_line()