File:Geom bar simple.png

From 太極
Jump to navigation Jump to search

Geom_bar_simple.png(559 × 414 pixels, file size: 15 KB, MIME type: image/png)

Summary

library(ggplot2)
data <- data.frame(
  category = c("A", "B", "C", "D"),
  value = c(3, 5, 2, 8)
)

ggplot(data, aes(x = category, y = value, fill = category)) +
  geom_bar(stat = "identity") +
  coord_flip() +
  labs(x = "Category", y = "Value") +
  # scale_fill_manual(values = c("A" = "red", "B" = "blue", "C" = "green", "D" = "purple"))
  theme_minimal()

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current15:47, 13 August 2024Thumbnail for version as of 15:47, 13 August 2024559 × 414 (15 KB)Brb (talk | contribs)<syntaxhighlight lang='r'> library(ggplot2) data <- data.frame( category = c("A", "B", "C", "D"), value = c(3, 5, 2, 8) ) ggplot(data, aes(x = category, y = value, fill = category)) + geom_bar(stat = "identity") + coord_flip() + labs(x = "Category", y = "Value") + # scale_fill_manual(values = c("A" = "red", "B" = "blue", "C" = "green", "D" = "purple")) theme_minimal() </syntaxhighlight>

The following page uses this file: