R 如何对特定点使用随钻测井

R 如何对特定点使用随钻测井,r,plot,lines,R,Plot,Lines,我想更改R图中两点[(4,1)和(5,0)]之间的线的厚度 x <- c(1, 2, 3, 4, 5, 6, 7, 8, 9) y <- c(0, 1, 0, 1, 0, 1, 0, 1, 0) plot(x, y, type="b", ann = FALSE, axes = FALSE, pch = 20, lwd=ifelse(x>=4 & x<=5, 3, 1)) x分段取(x0,y0)并绘制到(x1,y1) 使用plot,lwd无法接受向量。您可能想尝

我想更改R图中两点[(4,1)和(5,0)]之间的线的厚度

x <- c(1, 2, 3, 4, 5, 6, 7, 8, 9)
y <- c(0, 1, 0, 1, 0, 1, 0, 1, 0)

plot(x, y, type="b", ann = FALSE, axes = FALSE, pch = 20, lwd=ifelse(x>=4 & x<=5, 3, 1))
x分段取(x0,y0)并绘制到(x1,y1)


使用plot,
lwd
无法接受向量。您可能想尝试使用

plot(x, y, type="b", ann = FALSE, axes = FALSE, pch = 20)

lines(x[4:5], y[4:5], lwd = 3, type = "b")

plot
本身无法真正实现您想要的功能。您需要调用
plot
,然后调用
segments

XMIN = 4
XMAX = 5

plot(x, y, type="b", ann = FALSE, axes = FALSE, pch = 20)
xinds = x>=XMIN & x<=XMAX
segments(x[xinds][1:sum(xinds)-1],y[xinds][1:sum(xinds)-1],
         x[xinds][2:sum(xinds)],y[xinds][2:sum(xinds)], lwd=3)
XMIN=4
XMAX=5
绘图(x,y,type=“b”,ann=FALSE,axes=FALSE,pch=20)

xinds=x>=XMIN&x感谢回复。也可以使新行的长度与其他行相同。
XMIN = 4
XMAX = 5

plot(x, y, type="b", ann = FALSE, axes = FALSE, pch = 20)
xinds = x>=XMIN & x<=XMAX
segments(x[xinds][1:sum(xinds)-1],y[xinds][1:sum(xinds)-1],
         x[xinds][2:sum(xinds)],y[xinds][2:sum(xinds)], lwd=3)