Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要更改 emmeans 使用 emmip 制作的图例中的顺序,但我在网上找不到任何内容。
这就是我使用的代码:
emmip(anovaSameTaskErr, TaskSw ~ SubjectSw ~ CueDuration)
这三个变量有 2 个水平,CueDuration 是 X,另外两个之间的交互是图表上的线。图例中以特定顺序呈现的交互,我需要它们以另一个顺序排列。
emmeans::emmip只返回一个ggplot可以广泛操作的标准对象。
emmeans::emmip
ggplot
这是该函数帮助页面中的一个简单示例:
fit <- lm(noise ~ size * type * side, data = auto.noise) emmip(fit, type ~ size | side)
要更改图例的顺序,请在 中指定级别scale_*_discrete。
scale_*_discrete
emmip(fit, type ~ size | side) + scale_color_discrete(breaks = c("Octel", "Std"))