KMNanus
2016-Mar-25 14:07 UTC
[R] Manually inserting an extra tick on the y axis in ggplot2
I have called geom_hline to insert a horizontal line on the y axis of a plot at a given point. How can I insert the corresponding tick and its value on the y axis itself? Ken kmnanus at gmail.com 914-450-0816 (tel) 347-730-4813 (fax)
John Kane
2016-Mar-25 21:15 UTC
[R] Manually inserting an extra tick on the y axis in ggplot2
You might abe able to do it by using scale_y_continuous() but it would be a great help to see some (minimal) code and some sample data. Please have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html Re scale_y_continuous() have a look at http://stackoverflow.com/questions/22228696/specify-tick-marks-on-y-axis-ggplot2 which might suggest some approaches. John Kane Kingston ON Canada> -----Original Message----- > From: kmnanus at gmail.com > Sent: Fri, 25 Mar 2016 10:07:10 -0400 > To: r-help at r-project.org > Subject: [R] Manually inserting an extra tick on the y axis in ggplot2 > > I have called geom_hline to insert a horizontal line on the y axis of a > plot at a given point. > > How can I insert the corresponding tick and its value on the y axis > itself? > > Ken > kmnanus at gmail.com > 914-450-0816 (tel) > 347-730-4813 (fax) > > > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more!
Rolf Turner
2016-Mar-25 22:13 UTC
[R] [FORGED] Manually inserting an extra tick on the y axis in ggplot2
On 26/03/16 03:07, KMNanus wrote:> I have called geom_hline to insert a horizontal line on the y axis of a plot at a given point. > > How can I insert the corresponding tick and its value on the y axis itself?I think that axis() is what you need, but it's hard to tell without a reproducible example. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276
KMNanus
2016-Mar-25 22:16 UTC
[R] Manually inserting an extra tick on the y axis in ggplot2
Thanks. Actually, found a good answer online - I wanted a horizontal line with a y intercept of 12.6. I set m <- 12.6 I drew the line with geom_hline then added geom_text(aes(0,m,label = m, vjust = -1)) which worked just fine. Ken kmnanus at gmail.com 914-450-0816 (tel) 347-730-4813 (fax)> On Mar 25, 2016, at 5:15 PM, John Kane <jrkrideau at inbox.com> wrote: > > You might abe able to do it by using scale_y_continuous() but it would be a great help to see some (minimal) code and some sample data. > > Please have a look at > http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html > > Re scale_y_continuous() have a look at http://stackoverflow.com/questions/22228696/specify-tick-marks-on-y-axis-ggplot2 which might suggest some approaches. > > John Kane > Kingston ON Canada > > >> -----Original Message----- >> From: kmnanus at gmail.com >> Sent: Fri, 25 Mar 2016 10:07:10 -0400 >> To: r-help at r-project.org >> Subject: [R] Manually inserting an extra tick on the y axis in ggplot2 >> >> I have called geom_hline to insert a horizontal line on the y axis of a >> plot at a given point. >> >> How can I insert the corresponding tick and its value on the y axis >> itself? >> >> Ken >> kmnanus at gmail.com >> 914-450-0816 (tel) >> 347-730-4813 (fax) >> >> >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. > > ____________________________________________________________ > FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! > Visit http://www.inbox.com/photosharing to find out more! > >