[R] Manually inserting an extra tick on the y axis in ggplot2

KMNanus kmnanus at gmail.com
Fri Mar 25 23:16:21 CET 2016


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!
> 
> 



More information about the R-help mailing list