On 2010-04-23 10:53, zhenjiang xu wrote:
Yes. I put the real ranges instead of '...'. But I tried the following code
and it works. This is great! Thank you. Previously I thought you said ylim
was put inside the scales().

I did say that and I was wrong. If you put it
inside scales() as I suggested, then you have
to use limits=mylist,  not ylim=mylist.

This was due to my not testing the code carefully.
Sorry about that.

 -Peter Ehlers


library(lattice)
barchart(yield ~ variety | site,data=barley, groups = year, layout =
c(1,6),auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"),ylab = "Barley Yield (bushels/acre)",scales = list(x = list(rot =
45), y=list(relation='free')), ylim = mylist)



On Fri, Apr 23, 2010 at 11:51 AM, Peter Ehlers<ehl...@ucalgary.ca>  wrote:

Works for me. Did you replace the '....' in mylist()
with appropriate c(,) code? For example:

mylist<- list(c(0,30), c(40,80), c(0,50),
               c(0,50), c(0,50), c(0,50))

  -Peter Ehlers


On 2010-04-23 9:22, zhenjiang xu wrote:

Peter, thanks, but that doesn't work. Did I missed something?

library(lattice)
mylist<- list(c(0,30), c(40,80), ....)
barchart(yield ~ variety | site,data=barley, groups = year, layout =
c(1,6),auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"),ylab = "Barley Yield (bushels/acre)",scales = list(x = list(rot =
45), y=list(relation='free', ylim=mylist)))

On Thu, Apr 22, 2010 at 7:54 PM, Peter Ehlers<ehl...@ucalgary.ca>   wrote:

  On 2010-04-21 21:13, zhenjiang xu wrote:

  R experts,

Is there anyway to reorder inside each group? In the following example,
the
bar of year 1932 is always plotted before the bar of year 1931, may I
change
the order inside each groups of bars?


  Do you mean a different order in different panels? That seems to
me to defeat the purpose of panels. I can't think of an easy way
to do that.


  library(lattice)

barchart(yield ~ variety | site,data=barley, groups = year, layout =
c(1,6),auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"),ylab = "Barley Yield (bushels/acre)",scales = list(x = list(rot
=
45)))


Another questions is: may I specify the various ranges of y axis for
each
row of the panels? In the example of above, how can I change the y range
of
"Waseca" panel to (40,70) from the default (0,80)? Please notice I don't
want to set arguement "scales = list(y=list(relation='free'))", for the
automatic various setting of ranges for different panels isn't good
enough
for me. Basically I'd like to manually control y ranges.


You can use scales() with
  y=list(relation='free', ylim=mylist)

where mylist is a list of ylims:
  mylim<- list(c(0,30), c(40,80), ....)


Peter, thanks, but that doesn't work. Did I missed something?

library(lattice)
mylist<- list(c(0,30), c(40,80), ....)
barchart(yield ~ variety | site,data=barley, groups = year, layout =
c(1,6),auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"),ylab = "Barley Yield (bushels/acre)",scales = list(x = list(rot =
45), y=list(relation='free', ylim=mylist)))



  -Peter Ehlers


  Thank you!


--
Peter Ehlers
University of Calgary





--
Peter Ehlers
University of Calgary





--
Peter Ehlers
University of Calgary

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to