如何使用R在barplot中将y轴范围更改为百分比(%) [英] How to change y axis range to percent (%) from number in barplot with R

查看:2079
本文介绍了如何使用R在barplot中将y轴范围更改为百分比(%)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何将y轴改变为像图那样的百分比?我可以改变y轴范围,但我无法达到百分比。

解决方案

labels = percent 在最新版本的ggplot2(2.2.1)中已经过时。现在的命令是:

  + scale_y_continuous(labels = scales :: percent)


How can we change y axis to percent like the figure? I can change y axis range but I can't make it to percent.

解决方案

labels = percent is obsolete in the latest version of ggplot2 (2.2.1). The command now is:

+ scale_y_continuous(labels = scales::percent)

这篇关于如何使用R在barplot中将y轴范围更改为百分比(%)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆