Discussion 7
library(ggplot2)
data <- data.frame(
category = c("A", "B", "C", "D"),
value = c(20, 35, 40, 25)
)
plot <- ggplot(data, aes(x = category, y = value, fill = category)) +
geom_bar(stat = "identity") +
theme_minimal() +
labs(title = "Salient Information Visualization",
x = "Category", y = "Value") +
geom_text(aes(label = value), vjust = -0.5, color = "black", size = 5)
#font and color to the title
plot <- plot + theme(plot.title = element_text(family = "Arial", color = "blue", size = 20))
# font and color to text
plot <- plot + theme(axis.text.x = element_text(family = "Arial", color = "red", size = 12),
axis.text.y = element_text(family = "Arial", color = "red", size = 12))
# font and color to the legend
plot <- plot + theme(legend.title = element_text(family = "Arial", color = "green", size = 14),
legend.text = element_text(family = "Arial", color = "green", size = 12))
print(plot)
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family
## not found in Windows font database
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family
## not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family
## not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
