水平图格子上的正确名称

发布于 2024-11-09 17:32:08 字数 1066 浏览 0 评论 0原文

我正在尝试生成一些水平图的网格。现在我有两个问题。 这是一些示例数据

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)")

这将生成以下图。在此处输入图像描述

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

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

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

I'm trying to generate a trellis of some levelplots. Now I got 2 issues.
Here is some sampledata

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)")

This will generate the following plot.enter image description here

1)
I want the title of every plot not to be radiation, but the value of the radiation (e.g. 7,334,...)

2) I want to change the ticks from the x and y axis to letters instead of the current numbers. (instead of 5-10-15-20 I need E-J-O-T)

Can you guys point me (once again) in the right direction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独孤求败 2024-11-16 17:32:08

使用

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

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

using

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

will label your plots with the radiation value. the scales argument can be used to specify different labels.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文