14

こんにちは、次のコードを使用して、格子を使用して xyplot を生成しています

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

これにより、次のプロットが得られます。 ここに画像の説明を入力

提案どおりにパネルの順序を含めるようにコードを変更した後:

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

そして、正しい順序を取得します ここに画像の説明を入力

助けてくれてありがとう

4

1 に答える 1

8

Tempfactorに変換すると、次のようになりました。

ここに画像の説明を入力

次のように因子の順序を調整できます。

levels(rate$Temp) <- c("12", "9", "18", "15") #custom factor order
于 2011-06-15T14:17:29.930 に答える