Hi Christoph, There's a couple of things you need to do. Firstly, you need to reorder the factor according to how you want the data sorted
df$tld <- reorder_factor(df$tld, tapply(df$spam1, df$tld, mean)) is one way to do that. The reason that position dodge isn't working for you is because it only works within a layer, not across layers (I can't see any way to do this, because of potential heterogeneity of objects across layers). To get around this, you need to transform your data into a long form (what I call molten): dfm <- melt(df, id="tld") head(dfm) You can find out more about melt in the reshape package, http://had.co.nz/reshape. It's then easy to create the plot you want: qplot(tld, value, data = dfm, fill=variable, geom="bar", position="dodge") or qplot(tld, value, data = dfm, colour=variable, geom="line", group=variable) The problem is the radically different scales of the spam and share variables. ggplot doesn't support multiple y-axes (and never will) because of their poor perceptual properties. I would suggest drawing a separate graph for share, or using a scatterplot if you want to investigate the relationship between spam and share: qplot(spam1, share, data=df, colour="1") + geom_point(aes(x=spam2, colour="2")) + scale_colour_discrete("spam") Hope this helps! Hadley -- http://had.co.nz/ ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.