Jun Shen
2016-Sep-22 14:04 UTC
[R] Add annotation text outside of an xyplot (lattice package)
Dear list, Just wonder if there is a way to add annotation text outside an xyplot, (e.g. the bottom of the plot). the panel.text seems only add text within the plot. Thanks. Jun [[alternative HTML version deleted]]
Carlos Ortega
2016-Sep-22 14:39 UTC
[R] Add annotation text outside of an xyplot (lattice package)
Hi, Yes, you can use "latticeExtra" package and use a text layer on top of your current chart. Thanks, Carlos Ortega 2016-09-22 16:04 GMT+02:00 Jun Shen <jun.shen.ut at gmail.com>:> Dear list, > > Just wonder if there is a way to add annotation text outside an xyplot, > (e.g. the bottom of the plot). the panel.text seems only add text within > the plot. Thanks. > > Jun > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Saludos, Carlos Ortega www.qualityexcellence.es [[alternative HTML version deleted]]
Rainer Hurling
2016-Sep-24 06:49 UTC
[R] Add annotation text outside of an xyplot (lattice package)
Hi, one possible solution is to use ltext(). ltext(xcoord, ycoord, label="TEST", adj=c(0.5,0.5)) You have to know or to find out best fitting coordinates. Via adj you can control, if the text should adjust left, center or right to the coords, and above, center or bottom of them. HTH, Rainer Hurling Am 22.09.2016 um 16:04 schrieb Jun Shen:> Dear list, > > Just wonder if there is a way to add annotation text outside an xyplot, > (e.g. the bottom of the plot). the panel.text seems only add text within > the plot. Thanks. > > Jun
Bert Gunter
2016-Sep-24 15:04 UTC
[R] Add annotation text outside of an xyplot (lattice package)
No. ltext/panel.text plots text *within* panels; IIUC, the OP requested text outside the plots. For that see the details for "main" and/or "sub" in ?xyplot. I think it could also be done more flexibly via a legend or a key with a title but no content -- again, see the Help page -- but haven't tried it. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Sep 23, 2016 at 11:49 PM, Rainer Hurling <rhurlin at gwdg.de> wrote:> Hi, > > one possible solution is to use ltext(). > > ltext(xcoord, ycoord, label="TEST", adj=c(0.5,0.5)) > > You have to know or to find out best fitting coordinates. > > Via adj you can control, if the text should adjust left, center or right > to the coords, and above, center or bottom of them. > > HTH, > Rainer Hurling > > > Am 22.09.2016 um 16:04 schrieb Jun Shen: >> Dear list, >> >> Just wonder if there is a way to add annotation text outside an xyplot, >> (e.g. the bottom of the plot). the panel.text seems only add text within >> the plot. Thanks. >> >> Jun > > ______________________________________________ > 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.
Kevin Wright
2016-Sep-28 20:40 UTC
[R] Add annotation text outside of an xyplot (lattice package)
You can find an example of annotating lattice graphics with text anywhere on the graphics device using the pagenum package. See the vignette here: https://cran.r-project.org/web/packages/pagenum/vignettes/pagenum.html The pagenum package uses the grid package to add viewports for the annotation. The R code showing how this works is here: https://github.com/kwstat/pagenum/blob/master/R/pagenum.r Kevin Wright On Thu, Sep 22, 2016 at 9:04 AM, Jun Shen <jun.shen.ut at gmail.com> wrote:> Dear list, > > Just wonder if there is a way to add annotation text outside an xyplot, > (e.g. the bottom of the plot). the panel.text seems only add text within > the plot. Thanks. > > Jun > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Kevin Wright [[alternative HTML version deleted]]