PLOT IN R Language--Learn R

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述在这里插入图片描述在这里插入图片描述

par(mfrow = c(2, 3))

plot(x, y, bty = "o", main = "Default")
plot(x, y, bty = "7", main = "bty = '7'")
plot(x, y, bty = "L", main = "bty = 'L'")
plot(x, y, bty = "U", main = "bty = 'U'")
plot(x, y, bty = "C", main = "bty = 'C'")
plot(x, y, bty = "n", main = "bty = 'n'")

par(mfrow = c(1, 1))```

```r
plot(x, y, main = "Main title", cex = 2, col = "blue")

#---------------
# mtext function
#---------------

# Bottom-center
mtext("Bottom text", side = 1)

# Left-center
mtext("Left text", side = 2)

# Top-center
mtext("Top text", side = 3)

# Right-center
mtext("Right text", side = 4)


# Bottom-left
mtext("Bottom-left text", side = 1, adj = 0)

# Top-right
mtext("Top-right text", side = 3, adj = 1)


# Top with separation
mtext("Top higher text", side = 3, line = 2.5)

#--------------
# Text function
#--------------

# Add text at coordinates (-2, 2)
text(-2, 2, "More text")

# Add formula at coordinates (3, -3)
text(3, -3, expression(frac(alpha[1], 4)))```

```r
matplot(M, type = c("l"), lty = 1:6, col = "black", lwd = 3)

# Just to indicate the line types in the plot
j <- 0
invisible(sapply(seq(4, 40, by = 6),
                 function(i) {
                   j <<- j + 1
                   text(2, i, paste("lty =", j))}))```

```r
# Light gray background color
par(bg = "#f7f7f7")

# Add the plot
plot(x, y, col = "blue", pch = 16)

# Back to the original color
par(bg = "white")```

```r
M <- matrix(1:36, ncol = 6)

matplot(M, type = c("l"), lty = 1, col = "black", lwd = 1:6)

# Just to indicate the line widths in the plot
j <- 0
invisible(sapply(seq(4, 40, by = 6),
                 function(i) {
                   j <<- j + 1
                   text(2, i, paste("lwd =", j))}))```

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值