[英]how to add x-axis and y-axis value in the bar chart using ggplot
this is my code:这是我的代码:
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"
And I want to add x and y value inside each bar.我想在每个栏中添加 x 和 y 值。
I think you have two problems:我认为你有两个问题:
geom_text
geom_text
中的错字rownames
instead of "data".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.