Skip to content
Prev 308269 / 398503 Next

Retaining X axis labels when combining lattice graphs

Hi

I am not sure what you want but this works.

dput(PCB.hab.dist.paramaters.sub, "clipboard")

structure(list(a0 = c(0.04914389, 0.09828646, 0.14743004, 0.19650279,
0.24562863, 0.29475427, 0.34321628, 0.39224708, 0.4396493, 0.48849916,
0.04822307, 0.09644467, 0.14466705, 0.19265015, 0.24081446, 0.28897841,
0.33559511, 0.38114791, 0.4287918, 0.47643549, 0.04780828, 0.09551991,
0.14323731, 0.19111263, 0.23918126, 0.2870228, 0.33432429, 0.38066666,
0.42687761, 0.47430651, 0.04692786, 0.09382041, 0.1407303, 0.18771848,
0.23465733, 0.28160051, 0.3273384, 0.37086396, 0.41724004, 0.46361589
), b0 = c(-0.86892828, -0.86809873, -0.86819141, -0.87080033,
-0.87083379, -0.87079976, -0.88677178, -0.88675509, -0.91339697,
-0.91338693, 0.01662903, 0.01777045, 0.01821094, 0.01109928,
0.01112177, 0.01117924, -0.01359166, -0.04000038, -0.04000463,
-0.0400053, 0.22108929, 0.22315344, 0.22140675, 0.21089745, 0.2225532,
0.2227686, 0.20244, 0.1771299, 0.15966148, 0.15952135, 0.68334412,
0.69342727, 0.69065706, 0.68153656, 0.68206868, 0.68258821, 0.64959219,
0.6037267, 0.6041549, 0.60449739), c0 = c(0.0003944847, 0.0003945627,
0.0003945485, 0.000464031, 0.0004640277, 0.0004640311, 0.0005741337,
0.0005741361, 0.0007836726, 0.0007836736, 0.0004875154, 0.0004877006,
0.0004877409, 0.0005715912, 0.0005715677, 0.000571565, 0.0007090505,
0.0009754073, 0.0009754005, 0.000975399, 0.0004442073, 0.0003972545,
0.0003926791, 0.0005427425, 0.0004810829, 0.0004810596, 0.000580295,
0.0006780412, 0.0007653099, 0.0007652945, 0.0005052207, 0.000493725,
0.0005042077, 0.0005905591, 0.0005905449, 0.0005905167, 0.0006951437,
0.0008839044, 0.0008837397, 0.0008836109), Index = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "PCB", class = "factor"),
     Distribution = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
     1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
     3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
     4L, 4L), .Label = c("2 Patches", "4 Patches", "5 Patches",
     "9 Patches"), class = "factor"), REP = c(1L, 2L, 3L, 4L,
     5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
     9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L,
     3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L), Habitat.Amt = c(5L, 10L,
     15L, 20L, 25L, 30L, 35L, 40L, 45L, 50L, 5L, 10L, 15L, 20L,
     25L, 30L, 35L, 40L, 45L, 50L, 5L, 10L, 15L, 20L, 25L, 30L,
     35L, 40L, 45L, 50L, 5L, 10L, 15L, 20L, 25L, 30L, 35L, 40L,
     45L, 50L), Patches = c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
     2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L,
     5L, 5L, 5L, 5L, 5L, 5L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
     9L)), .Names = c("a0", "b0", "c0", "Index", "Distribution",
"REP", "Habitat.Amt", "Patches"), class = "data.frame", row.names = c(NA,
-40L))

##habitat amount graph
a0.Habitat<-
bwplot(Habitat.Amt~a0, data =PCB.hab.dist.paramaters.sub,
        par.settings = list(plot.symbol = list(pch = 2, col = "black"),
                            col=1,
                            box.umbrella=list(lty=1, col="black"),
       box.rectangle=list(lty=1, col="black")),
     ylab=list("Asymptote (a)",cex=1.5),
     xlab=list("Habitat Amount (% of Landscape)", cex=1.5))


##patch graph
a0.Patches<-
bwplot(Patches~a0, data =PCB.hab.dist.paramaters.sub,
        par.settings = list(plot.symbol = list(pch = 2, col = "black"),
                            col=1,
                            box.umbrella=list(lty=1, col="black"),
                            box.rectangle=list(lty=1, col="black")),
       # horizontal = F,
     ylab=list("Asymptote (a)",cex=1.5),
     xlab=list("Number of Habitat Patches", cex=1.5))


####combine two graphs
combined.a0<-c( "Response_to_Fragmentation"=a0.Patches,
"Response_to_Habitat_Amount"=a0.Habitat, layout=c(1,2), x.same=FALSE)


###update
update(combined.a0, main="TL Landscape",
scales=list(y=list(alternating=FALSE),x=list(alternating=TRUE )))

This gives you bwplots as the lattice function formula you had only 
produced points.
Please in future use dput.  for your data as it took extra time to 
work out what was going on.

I am not sure what you want as I could not get the bwplots first up. 
This may help you
You may have to specify axis limits  but it is a while since I have 
done something like this.

Not sure if ? trellis.focus is a help
Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
At 05:54 18/10/2012, you wrote: