向绘图中添加点
points是一个通用函数,用于在指定坐标处绘制点序列。将以坐标为中心打印指定的字符。
points(x, y = NULL, type = "p", ...)
示例代码
plot(-4:4, -4:4, type = "n") # setting up coord. system
points(rnorm(200), rnorm(200), col = "red")
# 等于以下代码
plot(rnorm(200), rnorm(200), col = "red")
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n")
# type = "n", for no plotting.
points(x = c(3, 3), y = c(3, 5), cex = c(2, 4),col=c("red",'blue'),
lwd = c(2, 4))
par(mar = rep(0,4))
plot(c(-1, 26), 0:1, type = "n", axes = FALSE)
text(0:25, 0.6, 0:25, cex = 0.5)
points(0:25, rep(0.3, 26), pch = 0:25, bg = "grey")
主要参数:
pch:形状
col:颜色
bg:pch=21:25给出的开放打印符号的背景(填充)颜色。
cex:字符缩放比例
lwd:线宽