I have the following tibble df
:
`Region` `Product` `Cost`
<fct> <fct> <dbl>
1 Japan Laptop 1500
2 Egypt Printer 450
...
and I would like to create a stacked barplot with Region
on the x-axis, and the each column being the sum of all the costs in that region broken down into Product
categories (i.e. a stack of total costs per product for the given region.)
I have unsuccessfully tried the following:
ggplot(df, aes(x = "Region", y = "Cost")) + geom_col(aes(fill = "Product"))
Could someone please help me out? Thanks!