导出点阵包xyplot中显示的scale_x和scale_y值

Export the scale_x and scale_y values displayed in the xyplot of the lattice package

有什么办法可以导出lattice包的xyplot中显示的scale_x和scale_y值吗?我 运行 例如以下代码,但似乎没有名称包含这些值。

library(lattice)
library(latticeExtra)

myplot <- xyplot(cars$speed~cars$dist)
print(myplot) 
# xx': 0, 20, ..., 120
# yy': 5, 10, ..., 25

str(myplot)

在此先感谢大家。

对于该绘图方案,您可以使用

提取 x 个刻度
myplot$xscale.components(lim = myplot$x.limits)$bottom$ticks$at

y

同步
myplot$yscale.components(lim = myplot$y.limits)$left$ticks$at

您可以在 lattice:::plot.trellis 函数中找到这些调用的更完整版本