小编Cha*_*les的帖子

R Plot :带有 legend() 的图例框的大小,与 RStudio 的差异

当我需要在 R 中编写一些代码时,我通常会使用 R Studio。但是一旦我想用图例绘制绘图,我就会切换到 R Gui,因为 RStudio 的图例框是不同的,对我来说不愉快。

\n\n

让我用一个例子来解释一下:

\n\n
sigma <- (1:7000)/10000\n\nratioMSY <- 1 - 5.26 * sigma^2\nplot(sigma, ratioMSY, type="l", ylab="MSY(sigma^2)/MSY(0)", ylim=c(0,1), \n lty=2, cex.lab=1.5, bty="n", cex.axis=1.5, lwd=3)\n\npar(new=T)\nratioMSY <- 1 - 2.78 * sigma^2\nplot(sigma, ratioMSY, type="l", ylab="MSY(sigma^2)/MSY(0)", ylim=c(0,1), lty=1, \n cex.lab=1.5, bty="n", cex.axis=1.5, lwd=3)\n\npar(new=T)\nratioMSY <- 1 - 1.96 * sigma^2\nplot(sigma, ratioMSY, type="l", ylab="MSY(sigma^2)/MSY(0)", ylim=c(0,1), lty=3, \n cex.lab=1.5, bty="n", cex.axis=1.5, lwd=3)\n\nlegend(0,0.4,c("r = 0.1","r = 0.2","r = 0.3"), lty=c(2,1,3), cex=1.5)\n
Run Code Online (Sandbox Code Playgroud)\n\n

现在我用 RStudio 和 RGui 来做。

\n\n

使用 RStudio: …

r

5
推荐指数
0
解决办法
1万
查看次数

标签 统计

r ×1