图中的 R 科学记数法 [英] R scientific notation in plots

查看:83
本文介绍了图中的 R 科学记数法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的情节:

#!/usr/bin/Rscript                                                                                    

png('plot.png')

y <- c(102, 258, 2314)                                                                         
x <- c(482563, 922167, 4462665)

plot(x,y)
dev.off()

R 使用 500、1000、1500 等作为 y 轴.有没有办法可以对 y 轴使用科学记数法并将 * 10^3 放在轴的顶部,如下图所示?

R uses 500, 1000, 1500, etc for the y axis. Is there a way I can use scientific notation for the y axis and put * 10^3 on the top of the axis like the figure below?

推荐答案

这有点像 hacky 的方式,但它没有任何问题:

This is sort of a hacky way, but there's nothing wrong with it:

plot(x,y/1e3, ylab="y /10^3")

这篇关于图中的 R 科学记数法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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