[R] ggplot2 x axis question

hadley wickham h.wickham at gmail.com
Mon Jun 29 18:05:04 CEST 2009


In that case, try:

qplot(reorder(factor(model),delta),delta,data=growthm.bic)

Deepayan: do you think there should also be a numeric method for reorder?

Hadley

On Mon, Jun 29, 2009 at 10:39 AM, Christopher
Desjardins<cddesjardins at gmail.com> wrote:
> Hi Hadley,
> Thanks for the reply and the great graphing package. That code is giving me
> the following error:
>
>> qplot(reorder(model,delta),delta,data=growthm.bic)
> Error in UseMethod("reorder") : no applicable method for "reorder"
>
> Cheers,
> Chris
>
> On 6/28/09 8:21 PM, hadley wickham wrote:
>
> Hi Chris,
>
> Try this:
>
> qplot(reorder(model, delta), delta, data = growthm.bic)
>
> Hadley
>
> On Sun, Jun 28, 2009 at 9:53 AM, Christopher
> Desjardins<cddesjardins at gmail.com> wrote:
>
>
> Hi,
> I have 45 models that I have named: 1, 2, 3, ... , 45 and I am trying to
> plot them in order of ascending BIC values. I am however unclear as to how I
> can get the models to line up on the x-axis by BIC and not by numeric order.
> For example, if model 5 has a lower BIC than 1, I want it to be the first
> point on the left hand side of the curve. This seems to work in plot:
>
> plot(1:45, growthm.bic$delta, type="b", xaxt = "n", xlab="Model",
> ylab=expression(Delta[k]))   # where growthm.bic$delta is my BIC value
> axis(1, at=1:45, labels=growthm.bic$Model) #where model is the name of the
> 45 models examined, i.e 1:45
>
> Currently using qplot I have this which doesn't not work as it arranges the
> BIC values in order from 1:45.
>
> qplot(model,delta,data=growthm.bic)
>
> Thanks. Also please cc me as I am a digest subscriber.
> Chris
>
> ______________________________________________
> R-help at 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.
>
>
>
>
>



-- 
http://had.co.nz/




More information about the R-help mailing list