其他分享
首页 > 其他分享> > R语言中arrows函数

R语言中arrows函数

作者:互联网

 

1、

> plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n")
> arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4)

 

 

2、 同时画两个箭头

> plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n")
> arrows(x0 = c(1, 1),  y0 = c(1, 2),  x1 = c(4, 4), y1 = c(4, 5))

 

 

3、 length参数条件箭须的长度。

par(mfrow = c(1,3))
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "length = 0.1")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, length = 0.1)
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "length = 0.5")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, length = 0.5)
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "length = 1")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, length = 1)

 

 

4、code参数调整箭头的类型

par(mfrow = c(1,3))
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "code = 1")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, code = 1)
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "code = 2")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, code = 2)
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "code = 3")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, code = 3)

 

 

5、angle调整箭头的角度

par(mfrow = c(1,3))
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "angle = 15")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, length = 0.5, angle = 15)
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "angle = 45")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, length = 0.5, angle = 45)
plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", main = "angle = 60")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, length = 0.5, angle = 60)

 

 

6、其他常见参数

plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n")
arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4, col = "red", lwd = 10, lty = 1)

 

 

来源:https://www.cnblogs.com/xudongliang/p/6756258.html

 

标签:plot,函数,xlim,arrows,y1,y0,ylim,语言
来源: https://www.cnblogs.com/liujiaxin2018/p/16280103.html