R 打印参数以外的值

R 打印参数以外的值,r,lattice,R,Lattice,示例数据/示例: x <- log(seq(1,11,1)) y <- seq(0,1,0.1) plot <- xyplot(y~x, type="l") update(plot, panel = function(...) { panel.xyplot(...)})+as.layer(xyplot(y[3]~x[3], type=c("p"), lwd=3, cex=3, pch=3)) 这将使值10变为2,5,并在函数x的末尾绘制点。是否有一种“绘制”-显示异常值的方法

示例数据/示例:

x <- log(seq(1,11,1))
y <- seq(0,1,0.1)
plot <- xyplot(y~x, type="l")
update(plot, panel = function(...) {
panel.xyplot(...)})+as.layer(xyplot(y[3]~x[3], type=c("p"), lwd=3, cex=3, pch=3))
这将使值10变为2,5,并在函数x的末尾绘制点。是否有一种“绘制”-显示异常值的方法

实际情况更为复杂,因此进行了简化。关于去哪里看的提示也会有帮助

编辑:TWL发布的解决方案在lattice中给了我提示:

tp <- sprintf("+ outlier")

mypanel<-function(x,y,...){
panel.xyplot(x, y, ...)
panel.text(2,1,labels=tp,cex=1.5,col="red")}

xyplot(y~x, type="l", panel=mypanel)

tp我可以推荐一种可能比使用lattice更简单的替代方法吗:

x <- log(seq(1,11,1))
y <- seq(0,1,0.1)

# set the margins and 'xpd' allows to plot outside the range
par(mar=c(5,5,5,7), xpd=T)

# plot the data within the range
plot(x,y, type="l", col="blue", frame=F, xlim=c(0,2.5))
points(x[3],y[3], col="blue", pch=3, cex=2)

# add the outlier by specifying the coordinate x and/or y outside the range
points(2.9, 1, col='blue', pch=20, cex=2)

x是否可以添加一个名为Outlier(或其他)的列,如果该值大于2.5,则将其设置为true,然后将Outlier点绘制为2.5,并使用不同的符号?也许给它贴上真实价值的标签?
x <- log(seq(1,11,1))
y <- seq(0,1,0.1)

# set the margins and 'xpd' allows to plot outside the range
par(mar=c(5,5,5,7), xpd=T)

# plot the data within the range
plot(x,y, type="l", col="blue", frame=F, xlim=c(0,2.5))
points(x[3],y[3], col="blue", pch=3, cex=2)

# add the outlier by specifying the coordinate x and/or y outside the range
points(2.9, 1, col='blue', pch=20, cex=2)