On Jan 17, 2008 9:53 AM, Thompson, David (MNR) <[EMAIL PROTECTED]> wrote: > Hello Hadley, > > I am trying to reproduce the following with ggplot: > a <- seq(0, 360, 5)*pi/180 ; a > ac <- sin(a + (45*pi/180)) + 1 ; ac > plot(a, ac, type='b', xaxt = "n") > axis(1, at=seq(0,6,1), labels=round(seq(0,6,1)*180/pi),1) > abline(v=c(45*pi/180, 225*pi/180)) > > I can get the basic plot: > p <- qplot(a, ac, geom=c('point', 'line')) ; p > > but cannot seem to add the vertical reference lines: > # representing NE and SW compass points > p + geom_vline(intercept=45*pi/180) > p + geom_vline(intercept=225*pi/180) > > nor find a reference to manipulating the axes labels > (still searching the news archives though). > > Also, I would like to add additional curves to the same > plot with the sequence 'asc' generated by: > s <- seq(5, 45, 10)*pi/180 ; s > asc <- lapply(s, function(x) x*cos(ac) + x*sin(ac)) ; asc
Try this: df <- data.frame(s, asc) p + geom_path(aes(x=s, y=asc), data=df) I think Domenico answered your other questions (thanks Domenico!) 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.