library("ggplot2")
head(food)
# \donttest{
library("ggthemes")
ggplot(data = food, aes(x = Energy)) +
geom_histogram(color = "white") +
facet_wrap(~Group) +
labs(title = "Energy value of the products", subtitle = "per 100 g",
x = "Energy value", y = "Number") +
theme_economist()
ggplot(data = food_mini, aes(x = Energy)) +
geom_histogram(color = "white") +
facet_wrap(~Group) +
labs(title = "Energy value of the products", subtitle = "per 100 g",
x = "Energy value", y = "Number") +
theme_economist()
ggplot(data = food, aes(x = Protein, y = Fats,
color = Group, size = Energy)) +
geom_point() +
scale_color_brewer(type = "qual", palette = "Dark2") +
labs(title = "Share of protein and fats", subtitle = "per 100 g",
y = "Fats [g]", x = "Protein [g]") +
theme_gdocs()
ggplot(data = food, aes(x = Group, y = Energy)) +
geom_rug(sides = "l") +
geom_violin(scale = "width", aes(fill = Group)) +
geom_text(data = food_max, aes(label = Name),
hjust = 0, vjust = 0, color = "blue4") +
geom_boxplot(width = 0.2, coef = 100) +
coord_flip() +
labs(title = "Energy value distribution", subtitle = "per 100 g") +
theme_gdocs() + theme(legend.position = "none")
# }
Run the code above in your browser using DataLab