Hi there,

I'm using the lattice package to create an xy plot of abundance vs. depth for 5 stages of barnacle larvae from 5 species. Each panel of the plot represents a different stage, while different loess smoothers within each panel should represent different species.

However, I would like depth to be on the y-axis and abundance to be on the x-axis, because this is more intuitive as an oceanographer. The smoothing curves would then represent the abundance profiles with depth of the larvae. I have tried just switching depth and abundance in the plot formula/coding, but this means that the loess smoother is based on averaging depth values for each abundance, which means that the curves give multiple possible abundances at each depth level. Rather, I would like the loess smooth to still be based on 'averaging' abundance at each depth.

Essentially, I would like a mirror image of the plot from this code:

ord<-order(Zoo_nocyp$Depth_m, decreasing=TRUE)
xyplot(log10Ab[ord]~factor(-1*Depth_m[ord])|StageF[ord],
         data=Zoo_nocyp[Zoo_nocyp$log10Ab!="0" ,],
         type=c("p","smooth"),
         par.settings=list(strip.background=list(col="white"), fontzize=list(text=16,points=10), lty = 0),
         space=0, border=NA,
         col=c("blue","red","green","purple","orange"),
         stack=TRUE, groups=Zoo_nocyp$SpeciesF,
         key=
           list(title="Species", cex.title=1,text=list(c("BB","BC","CH","SB","VS")),space="right",
                rectangles=list(size=2, border="white",col=c("blue","red","green","purple","orange"))),
         xlab="depth (m)", ylab="log10 abundance",
         layout=c(2,3))

which is different to what you get when you switch log10Ab and Depth_m.

Is there any way to specify the smoothers to be based on sequential y-axis values, rather than x? Or to get the mirror image of a plot?

I can provide a dataset offline, for those interested.

Thanks very much,

Raeanne


The Scottish Association for Marine Science (SAMS) is registered in Scotland as a Company Limited by Guarantee (SC009292) and is a registered charity (9206). SAMS has an actively trading wholly owned subsidiary company: SAMS Research Services Ltd a Limited Company (SC224404). All Companies in the group are registered in Scotland and share a registered office at Scottish Marine Institute, Oban Argyll PA37 1QA. The content of this message may contain personal views which are not the views of SAMS unless specifically stated. Please note that all email traffic is monitored for purposes of security and spam filtering. As such individual emails may be examined in more detail.

	[[alternative HTML version deleted]]

