# Load ggplot2
library(ggplot2)
# Create sample data
data <- data.frame(
category = c("Apple", "Microsoft"),
values = c(12, 5)
)
# Create the bar plot
ggplot(data, aes(category, values, fill = category)) +
geom_bar(stat = "identity", width = 0.7, color = "black") + labs(
title = "iPhone Release vs Windows Update",
subtitle = "Google Trends",
caption = "Source: Data Science with R"
) +
theme_minimal(base_size = 15) +
theme(
plot.title = element_text(hjust = 0.5, face = "bold", size = 18),
plot.subtitle = element_text(hjust = 0.5, size = 14),
panel.grid.major = element_line(color = "gray", linetype = "dashed"),
legend.position = "none"
)
