[R] ggplot2 x axis question

Christopher Desjardins cddesjardins at gmail.com
Sun Jun 28 16:53:51 CEST 2009


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




More information about the R-help mailing list