Hi R Users,
I'm trying to re-order the "site names" ("Waseca",
"Morris", ...). I'm using
following code:
libarry(lattice)
barchart(yield ~ variety | site, data = barley,
groups = year, layout = c(6,1), aspect=.7,
ylab = "Barley Yield (bushels/acre)",
scales = list(x = list(abbreviate = TRUE, rot=45, minlength 5)))
Can anyone help please.
-Gary
[[alternative HTML version deleted]]
On Dec 8, 2009, at 4:42 PM, Gary Miller wrote:> Hi R Users, > > I'm trying to re-order the "site names" ("Waseca", "Morris", ...). > I'm using > following code: > > libarry(lattice)# slip this code (or one with your preferred ordering) in before the plot call: barley$site <- factor(barley$site, levels = c("Waseca","Morris", "Crookston" , "University Farm","Grand Rapids" , "Duluth"))> barchart(yield ~ variety | site, data = barley, > groups = year, layout = c(6,1), aspect=.7, > ylab = "Barley Yield (bushels/acre)", > scales = list(x = list(abbreviate = TRUE, rot=45, > minlength > 5)))Comes out with rather squished labels although stretching the window helps.> > Can anyone help please. > > -Gary >David Winsemius, MD Heritage Laboratories West Hartford, CT
@ David and Phil: Thanks for your suggestions. @ Xin: Are you also working with barchart()? -Gary On Tue, Dec 8, 2009 at 5:23 PM, Phil Spector <spector@stat.berkeley.edu>wrote:> Gary - > If you create an ordered factor, barchart will plot the > sites in the order you specify. For example, try > > barley$site = ordered(barley$site,c('Waseca','Morris','Grand Rapids', > 'Duluth','University Farm','Crookston')) > > before plotting. > > - Phil Spector > Statistical Computing Facility > Department of Statistics > UC Berkeley > spector@stat.berkeley.edu > > > On Tue, 8 Dec 2009, Gary Miller wrote: > > Hi R Users, >> >> I'm trying to re-order the "site names" ("Waseca", "Morris", ...). I'm >> using >> following code: >> >> libarry(lattice) >> barchart(yield ~ variety | site, data = barley, >> groups = year, layout = c(6,1), aspect=.7, >> ylab = "Barley Yield (bushels/acre)", >> scales = list(x = list(abbreviate = TRUE, rot=45, minlength >> 5))) >> >> Can anyone help please. >> >> -Gary >> >> [[alternative HTML version deleted]] >> >> >> ______________________________________________ >> 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<http://www.r-project.org/posting-guide.html> >> and provide commented, minimal, self-contained, reproducible code. >> >>[[alternative HTML version deleted]]
In the same function as given below: Can anyone suggest how can I bold font
the "site names" ??? Thanks!
library(lattice)
barchart(yield ~ variety | site, data = barley,
groups = year, layout = c(6,1), aspect=.7,
ylab = "Barley Yield (bushels/acre)",
scales = list(x = list(abbreviate = TRUE, rot=45, minlength 5)))
On Tue, Dec 8, 2009 at 10:35 PM, Xin Ge <xingemaillist@gmail.com> wrote:
> Hi Gary, yes I'm using barchart() a lot these days... and was facing
same
> problem of re-ordering...
>
>
> On Tue, Dec 8, 2009 at 10:28 PM, Gary Miller
<mail2garymiller@gmail.com>wrote:
>
>> @ David and Phil: Thanks for your suggestions.
>>
>> @ Xin: Are you also working with barchart()?
>>
>> -Gary
>>
>> On Tue, Dec 8, 2009 at 5:23 PM, Phil Spector
<spector@stat.berkeley.edu
>> >wrote:
>>
>> > Gary -
>> > If you create an ordered factor, barchart will plot the
>> > sites in the order you specify. For example, try
>> >
>> > barley$site =
ordered(barley$site,c('Waseca','Morris','Grand Rapids',
>> >
'Duluth','University
>> Farm','Crookston'))
>> >
>> > before plotting.
>> >
>> > - Phil Spector
>> > Statistical Computing
Facility
>> > Department of Statistics
>> > UC Berkeley
>> > spector@stat.berkeley.edu
>> >
>> >
>> > On Tue, 8 Dec 2009, Gary Miller wrote:
>> >
>> > Hi R Users,
>> >>
>> >> I'm trying to re-order the "site names"
("Waseca", "Morris", ...). I'm
>> >> using
>> >> following code:
>> >>
>> >> libarry(lattice)
>> >> barchart(yield ~ variety | site, data = barley,
>> >> groups = year, layout = c(6,1), aspect=.7,
>> >> ylab = "Barley Yield (bushels/acre)",
>> >> scales = list(x = list(abbreviate = TRUE, rot=45,
minlength
>> >> >> 5)))
>> >>
>> >> Can anyone help please.
>> >>
>> >> -Gary
>> >>
>> >> [[alternative HTML version deleted]]
>> >>
>> >>
>> >> ______________________________________________
>> >> 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<http://www.r-project.org/posting-guide.html>
>> <http://www.r-project.org/posting-guide.html>
>> >> and provide commented, minimal, self-contained, reproducible
code.
>> >>
>> >>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
[[alternative HTML version deleted]]