R 使用ggplot翻转条形图上的数字
我使用以下代码创建了一个绘图:R 使用ggplot翻转条形图上的数字,r,ggplot2,R,Ggplot2,我使用以下代码创建了一个绘图: p <- ggplot(flexbooks, aes(x=SchoolYear, y=Count,fill=Type)) + geom_bar(stat="identity") + geom_text(data=flexbooks,aes(label=Count),vjust=-1,hjust=0.5) p p尝试反转图例: p <- ggplot(flexbooks, aes(x=SchoolYear, y=Count,fill=Type))
p <- ggplot(flexbooks, aes(x=SchoolYear, y=Count,fill=Type)) + geom_bar(stat="identity") +
geom_text(data=flexbooks,aes(label=Count),vjust=-1,hjust=0.5)
p
p尝试反转图例:
p <- ggplot(flexbooks, aes(x=SchoolYear, y=Count,fill=Type)) +
geom_bar(stat="identity") +
geom_text(data=flexbooks,aes(label=Count),vjust=-1,hjust=0.5) +
guides(fill = guide_legend(reverse = TRUE))
p您的问题不包含答案。因此,很难理解您的问题并给出适当的答案。请提供您的数据(例如,使用dput()
)或使用R中的一个示例数据集。此外,请在您的帖子中添加重现问题所需的最少代码。