Colleagues, To add an annotation using ggplot, I've used annotate("text",x=17,y=2130,label="16 u"). However, this does not work when trying to annotate box plots by groups since groups are factors. Any advice would be appreciated. Thomas Subia ASQ CQE IMG Companies? 225 Mountain Vista Parkway Livermore, CA 94551 T.?(925) 273-1106 F.?(925) 273-1111 E. tsubia at imgprecision.com Precision Manufacturing for Emerging Technologies imgprecision.com? The contents of this message, together with any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain information that is legally privileged, confidential and exempt from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If you have received this message in error, please notify the original sender or IMG Companies, LLC at Tel: 925-273-1100 immediately by telephone or by return E-mail and delete this message, along with any attachments, from your computer. Thank you.
Since factor levels (groups) are coded by integers, you can use 1, 2, 3 etc. as your x values. If you want to annotate in between you can simply pick values in between 1, 2, 3, etc. On Wed, Feb 19, 2020, 13:26 Thomas Subia, <tsubia at imgprecision.com> wrote:> Colleagues, > > To add an annotation using ggplot, I've used > annotate("text",x=17,y=2130,label="16 u"). > > However, this does not work when trying to annotate box plots by groups > since groups are factors. > > Any advice would be appreciated. > > Thomas Subia > ASQ CQE > > IMG Companies > 225 Mountain Vista Parkway > Livermore, CA 94551 > T. (925) 273-1106 > F. (925) 273-1111 > E. tsubia at imgprecision.com > > > Precision Manufacturing for Emerging Technologies > imgprecision.com > > The contents of this message, together with any attachments, are intended > only for the use of the individual or entity to which they are addressed > and may contain information that is legally privileged, confidential and > exempt from disclosure. If you are not the intended recipient, you are > hereby notified that any dissemination, distribution, or copying of this > message, or any attachment, is strictly prohibited. If you have received > this message in error, please notify the original sender or IMG Companies, > LLC at Tel: 925-273-1100 immediately by telephone or by return E-mail and > delete this message, along with any attachments, from your computer. Thank > you. > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
Hello, If groups are factors, pass the level you want to annotate. This works, note the 'x' value: ggplot(iris, aes(Species, Petal.Length)) + geom_boxplot() + annotate(geom = "text", x = "versicolor", y = 6, label = "16 u") Hope this helps, Rui Barradas ?s 20:26 de 19/02/20, Thomas Subia escreveu:> Colleagues, > > To add an annotation using ggplot, I've used annotate("text",x=17,y=2130,label="16 u"). > > However, this does not work when trying to annotate box plots by groups since groups are factors. > > Any advice would be appreciated. > > Thomas Subia > ASQ CQE > > IMG Companies > 225 Mountain Vista Parkway > Livermore, CA 94551 > T.?(925) 273-1106 > F.?(925) 273-1111 > E. tsubia at imgprecision.com > > > Precision Manufacturing for Emerging Technologies > imgprecision.com > > The contents of this message, together with any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain information that is legally privileged, confidential and exempt from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If you have received this message in error, please notify the original sender or IMG Companies, LLC at Tel: 925-273-1100 immediately by telephone or by return E-mail and delete this message, along with any attachments, from your computer. Thank you. > > ______________________________________________ > 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. >