[英]How to make a bar-chart by using two variables on x-axis and a grouped variable on y-axis?
[英]how to add x-axis and y-axis value in the bar chart using ggplot
這是我的代碼:
ggplot(data = samplesolution2, aes(x = transdt, y = transAmount, group = bankAcctID, fill = bankAcctID)) +
geom_bar(stat = "identity") +
geom_test(label = rownames(data), nudge_x = 0.25, nudge_y = 0.25, check_overlap = T) +
ggtitle(label = "Showing Only Total Deposits Over $200") +
facet_wrap(~ bankAcctID, ncol = 1)
Error in geom_test(label = rownames(data), nudge_x = 0.25, nudge_y = 0.25, :
could not find function "geom_test"
我想在每個欄中添加 x 和 y 值。
我認為你有兩個問題:
geom_text
中的錯字rownames
時使用 data.frame 的名稱,而不是“data”。ggplot(data = samplesolution2,
aes(x = transdt, y = transAmount, group = bankAcctID, fill = bankAcctID)) +
geom_bar(stat = "identity") +
geom_text(label = rownames(samplesolution2), nudge_x = 0.25, nudge_y = 0.25, check_overlap = T) +
ggtitle(label = "Showing Only Total Deposits Over $200") +
facet_wrap(~ bankAcctID, ncol = 1)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.