79184332

Date: 2024-11-13 10:01:05
Score: 3
Natty:
Report link

Like this?

library(ggplot2)

df <- data.frame(
  location = c(1, 2, 2, 1),
  year = c(22, 23, 24, 22),
  measurement = c("parameter1", "parameter2", "parameter1", "parameter3"),
  value = c(3, 2, 4, 2),
  treatment = c("A", "B", "A", "C")
)

ggplot(df, aes(x = factor(year), y = value, fill = treatment)) +
  geom_bar(stat = "identity", position = "stack") +
  facet_wrap(~ location) +
  labs(x = "Year", y = "Value", fill = "Treatment") +
  theme_minimal()

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Jóhann Páll Hreinsson