[R] gplots
Warnes, Gregory R
gregory.r.warnes at pfizer.com
Tue Jan 17 21:01:24 CET 2006
The plotmeans() function uses the order of the factor levels. To change the order in the plot, change the order of the factor levels.
For example:
> data(state)
> plotmeans(state.area ~ state.region)
Plots the groups in the order
levels(state.region)
> levels(state.region)
[1] "Northeast" "South" "North Central" "West"
You can change the order of the levels using the gdata:::reorder.factor function:
> state.region <- reorder.factor(state.region, c("Northeast", "North Central", "South" "West")),
Now, doing
> plotmeans(state.area ~ state.region)
will show the plot with the new order.
-Greg
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Stephen
> Sent: Monday, January 16, 2006 11:26 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] gplots
>
>
> Hi
>
> I am sure that this question has been asked before ... appologies in
> advance
>
> This - which comes out very nicely - better than the commercial stuff.
> plotmeans (cdpy~Dodefordpy, Data = Dataset, connect = False,
> minbar = 1,
> mean.labels = FALSE, col = "blue", barwidth = 1.5, barcol = "red",
> ci.label = FALSE, xlab="Onset", pch = 15, par(las =2)).
>
> Only one snag I want to order the X axis by the way it is
> sorted in the
> data not by the n size group categories.
>
> The data are sorted by the Dodefordpy categories - not mumeric -
> confering to the way I'd like the x axis.
>
> Hence how do I order the x axis not by n but by the way the file is
> ordered.
>
>
>
> Thanks
>
> S
>
>
>
> > version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 2.1
> year 2005
> month 12
> day 20
> svn rev 36812
> language R
> >
>
>
> Nana Mail <http://mail.nana.co.il> - Get Your Free Personal
> Outlook 2003
> Now
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
>
----------------------------------------------------------------------
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}
More information about the R-help
mailing list