我正在尝试生成一些水平图的格子.现在我有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)")
Run Code Online (Sandbox Code Playgroud)
这将生成以下图表.
1)我希望每个情节的标题不是辐射,而是辐射的价值(例如7,334,......)
2)我想将x和y轴的刻度更改为字母而不是当前数字.(而不是5-10-15-20我需要EJOT)
你们能指点我(再一次)朝正确的方向走吗?
运用
levelplot(fit ~ wind * temperature | as.factor(radiation), ... , scales= list(x=list(labels=c('','E','J','O','T'))))
Run Code Online (Sandbox Code Playgroud)
将用辐射值标记您的地块.scales参数可用于指定不同的标签.