Rich Shepard
2011-Dec-30 14:56 UTC
[R] Lattice: Setting Conditioning Panel Order in Trellis Plots
I've looked in Deepayan Sarkar's book without finding how to specify the order of conditioning panels in a trellis plot. Here's the issue I'm trying to resolve: Sampling locations along a stream channel are not sequentially numbered. For example, the panel order for one plot (lower left to upper right, 4 panels per row): SC, SC-1, SC-100, SC-139, SC-140, SC-141, SC-145. SC-2, SC-3, and SC-50. This is normal collation order, while I need numeric order. Is there a way for me to specify the panel order so the display is SC, SC-1, SC-2, SC-3, SC-50, SC-100, SC-139, SC-140, SC-141, SC-145? If so, please teach me how to do this. Rich
Duncan Murdoch
2011-Dec-30 15:06 UTC
[R] Lattice: Setting Conditioning Panel Order in Trellis Plots
On 11-12-30 9:56 AM, Rich Shepard wrote:> I've looked in Deepayan Sarkar's book without finding how to specify the > order of conditioning panels in a trellis plot. Here's the issue I'm trying > to resolve: > > Sampling locations along a stream channel are not sequentially numbered. > For example, the panel order for one plot (lower left to upper right, 4 > panels per row): SC, SC-1, SC-100, SC-139, SC-140, SC-141, SC-145. SC-2, > SC-3, and SC-50. This is normal collation order, while I need numeric order. > > Is there a way for me to specify the panel order so the display is SC, > SC-1, SC-2, SC-3, SC-50, SC-100, SC-139, SC-140, SC-141, SC-145? If so, > please teach me how to do this.You don't describe the variable holding those labels. If it is a factor with the levels in the desired order then it should display properly. To get that, try something like this (simplified to fewer levels, because I'm lazy): # Make up some sample data: x <- c("SC", "SC-1", "SC-100", "SC-2") # Set the levels in the desired order: x <- factor(x, levels=c("SC", "SC-1", "SC-2", "SC-100")) Duncan Murdoch
Possibly Parallel Threads
- Controlling Order of Panels in Lattice Trellis Plots
- How to re-order panels and y-axis values in trellis display using lattice
- [FORGED] Extracting specified pages from a lattice ("trellis") object.
- Bivariate Scatter Plots with Lattice
- [FORGED] Extracting specified pages from a lattice ("trellis") object.