Skip to content

Instantly share code, notes, and snippets.

ggplot(data, aes(x = quarter, y = profit, fill = product, label = profit)) +
geom_col() +
scale_fill_manual(values = c("#3db5ff", "#0099f9")) +
geom_text(position = position_stack(vjust = 0.5), size = 4, color = "#ffffff")
ggplot(data_a, aes(x = quarter, y = profit)) +
geom_col(fill = "#0099f9") +
geom_text(aes(label = profit), vjust = 2, size = 5, color = "#ffffff")
library(dplyr)
data_a <- data %>%
filter(product == "A")
ggplot(data_a, aes(x = quarter, y = profit)) +
geom_col(fill = "#0099f9") +
geom_text(aes(label = profit), vjust = -0.5, size = 5)
ggplot(data, aes(x = quarter, y = profit, fill = product)) +
geom_col(position = position_dodge()) +
scale_fill_manual(values = c("#3db5ff", "#0099f9")) +
coord_flip()
ggplot(data, aes(x = quarter, y = profit)) +
geom_col(fill = "#0099f9") +
coord_flip()
ggplot(data, aes(x = quarter, y = profit, fill = product)) +
geom_col(position = position_dodge()) +
scale_fill_manual(values = c("#3db5ff", "#0099f9"))
ggplot(data, aes(x = quarter, y = profit, fill = product)) +
geom_col(position = position_dodge())
ggplot(data, aes(x = quarter, y = profit, fill = product)) +
geom_col() +
scale_fill_brewer(palette = "Set1")
ggplot(data, aes(x = quarter, y = profit, fill = product)) +
geom_col() +
scale_fill_manual(values = c("#69c6ff", "#0099f9"))
ggplot(data, aes(x = quarter, y = profit, fill = product)) +
geom_col()