# Re: [R] Lattice: reversing order of panel placement in conditional histograms

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Tue 26 Jul 2005 - 04:19:47 EST

On 7/23/05, Prof Brian Ripley <ripley@stats.ox.ac.uk> wrote:
> >From what I understand, you want to set up a factor with the levels
> reversed. It is not that `5 is larger than 1', but that you created a
> factor with the levels in alphabetic order. Lattice plots in the order of
> the levels.
>
> Something like f <- factor(f, levels=rev(levels(f))) will do this.
>
> For the horizontal factor, give the levels in the order you want them to
> appear (which might not be the reverse of alphabetic).
>
>
> On Sat, 23 Jul 2005, Sam Ferguson wrote:
>
> > I have a question about lattice in general, and histogram specfically.
> > How do you control the ordering of factors that controls the placement
> > of the conditional panels. I have a dataset with factors that go
> > 'Q1','Q2',"Q3','Q5' and of course I want the plot to place Question Q1
> > at the top and Question Q5 at the bottom of the graphical output.

One additional comment: if you think top to bottom is the natural order (which lattice doesn't), try using

as.table = TRUE

Deepayan

> > histogram() does the opposite as 5 is larger than 1. Similarly my
> > 'AlertFormat' factor is a textual category, and I need the data to read
> > from left to right (representing old to new) , with 'New A & V' on the
> > right, and 'Pre-existing A & V' on the left, which is the opposite to
> > how histogram plots.

[...]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jul 26 04:30:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:01 EST