不想在绘图轴上使用科学记数法 [英] Do not want scientific notation on plot axis

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

问题描述

我经常使用 plot 命令在R中做各种散点图。

只有一个绘图轴以科学记数法标记。我不明白R何时决定转用科学记数法。令人惊讶的是,它通常打印的数字在标记一个情节时不会以科学记数法写出,例如它将5标记为5e + 00。假设你的对数轴高达1000,科学记数法对于这样的小数字是不合理的。



我想压制这种行为,我总是希望R来显示整数值。这可能吗?



我试过 options(scipen = 10),但它开始写入5.0而不是5,而在另一个轴上5仍然是5等等。我怎么能在我的R图的纯整数值?



我在Windows 7上使用R 2.12.1。 / p>

解决方案使用 options(scipen = 5)或其他一些足够高的数字。 scipen选项决定了R切换到科学记数法的可能性,数值越高,切换的可能性越小。设置选项后,如果它仍然有科学记数法,请将其设置为更高的数字。


I regularly do all kinds of scatter plots in R using the plot command.

Sometimes both, sometimes only one of the plot axes is labelled in scientific notation. I do not understand when R makes the decision to switch to scientific notation. Surprisingly, it often prints numbers which no sane human would write in scientific notation when labelling a plot, for example it labels 5 as 5e+00. Let's say you have a log-axis going up to 1000, scientific notation is unjustified with such "small" numbers.

I would like to suppress that behaviour, I always want R to display integer values. Is this possible?

I tried options(scipen=10) but then it starts writing 5.0 instead of 5, while on the other axis 5 is still 5 etc. How can I have pure integer values in my R plots?

I am using R 2.12.1 on Windows 7.

解决方案

Use options(scipen=5) or some other high enough number. The scipen option determines how likely R is to switch to scientific notation, the higher the value the less likely it is to switch. Set the option before making your plot, if it still has scientific notation, set it to a higher number.

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

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