如何在简单的莱迪思图中更改面板的顺序 [英] How to change the order of the panels in simple Lattice graphs
本文介绍了如何在简单的莱迪思图中更改面板的顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码使用晶格生成xyplot
Hi I am using the following code to generate an xyplot using lattice
xyplot(Rate~Weight|Temp, groups=Week, rate,
pch=c(15,16,17,3), col=c("blue","red","green","purple"),
as.table=TRUE,
xlab="Weight (gr)", ylab="Rate (umol/L*gr)",
main="All individuals and Treatments at all times",
strip=strip.custom(strip.names=1),
key=
list(text=list(c("Week","1","2","6","8")),
points=list(pch=c(NA,15,16,17,3),col=c(NA,"blue","red","green","purple")),
space="right")
)
这给了我以下情节:
This gives me the following plot:
现在将代码更改为按建议包括面板顺序后:
Now after changing the code to include panel order as suggested:
xyplot(Rate~Weight|Temp, groups=Week, rate,
index.cond=list(c(4,1,2,3)),#this provides the order of the panels
pch=c(15,16,17,3), col=c("blue","red","green","purple"),
as.table=TRUE,
xlab="Weight (gr)", ylab="Rate (umol/L*gr)",
main="All individuals and Treatments at all times",
strip=strip.custom(strip.names=1),
key=
list(text=list(c("Week","1","2","6","8")),
points=list(pch=c(NA,15,16,17,3),col=c(NA,"blue","red","green","purple")),
space="right")
)
我们得到正确的订单
and we get the correct order
感谢您的帮助
推荐答案
我将Temp
转换为因子并得到了这个:
I converted Temp
to factor and got this:
您可以像这样按因子顺序进行调节:
You can temper with factor order like so:
levels(rate$Temp) <- c("12", "9", "18", "15") #custom factor order
这篇关于如何在简单的莱迪思图中更改面板的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文