Examveda

How do you create a stacked bar plot in ggplot2 for two categorical variables category1 and category2?

A. geom_bar(aes(x = category1, fill = category2), position = "stack")

B. stacked_bar(category1, category2)

C. geom_bar(mapping = aes(x = category1, fill = category2), stat = "stack")

D. bar_plot_stack(category1, category2)

Answer: Option A


This Question Belongs to R Programming >> Data Visualization With Ggplot2

Join The Discussion

Related Questions on Data Visualization with ggplot2