不想在绘图轴上使用科学记数法 [英] Do not want scientific notation on plot axis
问题描述
我经常使用 plot
命令在R中做各种散点图。
我想压制这种行为,我总是希望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屋!