Ancestry <- data.frame(Race = c("European", "African American", "Asian", "Hispanic", "Other"), Proportion = c(40, 30, 10, 15, 5))
Ancestry %>%
ggplot(aes(y = Proportion, fill = Race)) +
geom_bar(stat="identity", colour="white")
Running the above code gives me the following error:
Warning in min(x, na.rm = na.rm) :
no non-missing arguments to min; returning Inf
Warning in max(x, na.rm = na.rm) :
no non-missing arguments to max; returning -Inf
Warning in min(diff(sort(x))) :
no non-missing arguments to min; returning Inf
Warning in x - width/2 :
longer object length is not a multiple of shorter object length
Warning in x + width/2 :
longer object length is not a multiple of shorter object length
Error in data.frame(list(y = c(40, 30, 10, 15, 5), fill = c(3L, 1L, 2L, :
arguments imply differing number of rows: 5, 2947
I'm looking to create a stacked barchart similar to this:
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…