ggplot一元运算符的无效参数 [英] ggplot invalid argument to unary operator
本文介绍了ggplot一元运算符的无效参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
运行ggplot饼图时出现以下错误消息...知道是什么问题吗?
I am getting the below error msg when running ggplot pie chart...any idea what issue could be?
代码是:
ggplot(pie_unrated, aes(x = "FEBRUARY IBG UNRATED Book COMPOSITION", y = prop,
fill = ProductDetails)) + geom_bar(width = 1,
stat = "identity", color = "white")
+ coord_polar(theta = "y", start = 0) + ggpubr::fill_palette("jco")
+theme_void()
我的错误消息:
Error in +coord_polar(theta = "y", start = 0) :
invalid argument to unary operator
>
dput(head(pie_unrated)
structure(list(RatingStatus = c("UNRATED", "UNRATED", "UNRATED",
"UNRATED", "UNRATED", "UNRATED"), ProductDetails = structure(c(1L,
2L, 6L, 7L, 9L, 10L), .Label = c("ACB", "Bonds", "Cash and Short Term",
"Deposit with Banks", "LBD", "LC", "LG", "loan", "Loan", "OD",
"Treasury Bonds"), class = "factor"), counts = c(10L, 1L, 21L,
102L, 758L, 126L), prop = c(1, 0.1, 2.1, 10, 74.5, 12.4), lab.ybos = c(0.5,
1.05, 2.15, 8.2, 50.45, 93.9)), .Names = c("RatingStatus", "ProductDetails",
"counts", "prop", "lab.ybos"), row.names = c(NA, -6L), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"), vars = "RatingStatus", drop = TRUE, indices = list(
0:5), group_sizes = 6L, biggest_group_size = 6L, labels = structure(list(
RatingStatus = "UNRATED"), row.names = c(NA, -1L), class = "data.frame", vars = "RatingStatus", drop = TRUE, .Names = "RatingStatus"))
推荐答案
library(ggpubr)
ggplot(pie_unrated,
aes(x = "FEBRUARY IBG UNRATED Book COMPOSITION", y = prop, fill = ProductDetails)) +
geom_bar(width = 1,stat = "identity", color = "white") +
coord_polar(theta = "y", start = 0) + ggpubr::fill_palette("jco") + theme_void()
这篇关于ggplot一元运算符的无效参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文