如何在matplot中的轴上向数字添加逗号 - R.

Isl*_*nds -1 plot r

我想在我的情节中向y轴添加逗号,但到目前为止我尝试的东西不起作用:

matplot(X, Y, type = "l", col = "green", xlab = "Time (years)", ylab = "Cost", main = "BLANK", ylim = (30000,60000), xlim = c(0,15))
Run Code Online (Sandbox Code Playgroud)

就是我拥有的.

不确定如何在30,000 - 60,000上添加逗号,该逗号应出现在y轴上.

编辑:对不起,我在matplot标签中的意思是:http://stat.ethz.ch/R-manual/R-patched/library/graphics/html/matplot.html

Dav*_*urg 5

你可以使用的组合yaxt = "n",axisprettyNum

Y <- seq(30000, 60000, 2000)
X <- 0:15
matplot(X, Y, type = "l", col = "green", xlab = "Time (years)", ylab = "Cost", main = "BLANK", yaxt = "n")
axis(2, Y, labels = prettyNum(Y, big.mark = ","))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述