在ggplot中将玫瑰图中的y轴从计数改为百分比,可以通过以下步骤实现:
install.packages("ggplot2")
library(ggplot2)
p <- ggplot(data = df, aes(x = angle))
p <- p + geom_bar(fill = "blue")
p <- p + coord_polar()
p <- p + scale_y_continuous(labels = scales::percent)
print(p)
这样,就可以在ggplot中将玫瑰图中的y轴从计数改为百分比了。
推荐的腾讯云相关产品:腾讯云服务器(https://cloud.tencent.com/product/cvm)和腾讯云数据库(https://cloud.tencent.com/product/cdb)可以提供云计算和数据库相关的服务。
领取专属 10元无门槛券
手把手带您无忧上云