在 Lattice 中使用自己的任意值 ylim

Use own arbitrary values ylim within Lattice

我需要这个例子的点阵实现;

set.seed(12)
df <- data.frame(y=seq(0,1,0.1),x=rnorm(11,1,1))

# use different scale (y covariate) as used for plotting 
df$Num <- seq(0.5,1,0.05)

plot(df$x, yaxt="n")
axis(2, df$x[3], df$Num[3])

那么如何显示用于图表的不同数字。

df$L <- letters[1:nrow(df)]

plot(df$x, yaxt="n")
axis(2, df$x[3], df$L[3])

如何在网格中实现相同的东西xyplot

你的第一个例子的翻译是

xyplot(x~seq_along(x), df, 
    scales=list(y=list(at=df$x[3], labels=df$Num[3])))

?xyplot 帮助页面中阅读有关 scales= 参数的模式。