在水平图的格子上正确的名称

时间:2011-05-25 07:06:52

标签: r lattice

我正在尝试生成某些关卡的格子。现在我有2个问题。 这是一些采样数据

library(lattice)
require(stats)
attach(environmental)
ozo.m <- loess((ozone^(1/3)) ~ wind * temperature * radiation,
    parametric = c("radiation", "wind"), span = 1, degree = 2)
w.marginal <- seq(min(wind), max(wind), length.out = 50)
t.marginal <- seq(min(temperature), max(temperature), length.out = 50)
r.marginal <- seq(min(radiation), max(radiation), length.out = 4)
wtr.marginal <- list(wind = w.marginal, temperature = t.marginal,
        radiation = r.marginal)
grid <- expand.grid(wtr.marginal)
grid[, "fit"] <- c(predict(ozo.m, grid))
levelplot(fit ~ wind * temperature | radiation, data = grid,
        cuts = 10, region = TRUE,
        xlab = "Wind Speed (mph)",
        ylab = "Temperature (F)",
        main = "Cube Root Ozone (cube root ppb)")

这将生成以下图表。enter image description here

1) 我希望每个情节的标题不是辐射,而是辐射的价值(例如7,334,......)

2)我想将x和y轴的刻度更改为字母而不是当前数字。 (而不是5-10-15-20我需要E-J-O-T)

你们能指点我(再一次)正确的方向吗?

1 个答案:

答案 0 :(得分:5)

使用

levelplot(fit ~ wind * temperature | as.factor(radiation), ... , scales= list(x=list(labels=c('','E','J','O','T'))))

将使用辐射值标记您的图。 scales参数可用于指定不同的标签。