Hello,
I'm having a problem renaming and sorting the underlying factor of a
ggplot2 based plot. Here's my code:
---8<----------
> delta <- ggplot(subset(data, Model==c("dyn", "dl4", "dl3")),
> aes(x=Problemsize, y=Fitness)) +
geom_smooth(size=1, color="black", fill=alpha("blue", 0.2))+
geom_point(size=0.5, aes(colour=DeltaConfig))+
scale_colour_gradient2(expression(bold(paste(Delta,"Config"))),
limits=c(0,10), midpoint=5,
low="green", mid="yellow", high="red")
> delta <- delta + facet_grid(Model ~ . , margins = TRUE)
> delta
---8<----------
and the data
---8<----------
> data
Model Problemsize Fitness DeltaConfig
1 dl1 3 81.5271 2.4495
2 dl1 3 83.1999 2.4495
...
---8<----------
I want to select a subset of the possible models and display the
resulting three plots in a column. This works fine, but: the displayed
names and order is wrong. Instead of the models "dl3","dl4","dyn"
I want to change dl* to rm* and the order to "dyn","rm3","rm4".
I hope it's understandable what I want. I tried to use factor()
function in a thousand combinations, but I don't seem to get it. Can
someone help me?
Thanks in advance,
Arne
______________________________________________
[email protected] 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.