[R] text duplication bug in mtext?
dwinsemius at comcast.net
Fri Jan 1 21:57:54 CET 2016
> On Jan 1, 2016, at 10:36 AM, Arkay <arkay7777 at gmail.com> wrote:
> Not sure if this has already been reported but I think that there might
> be a bug in mtext that causes the text in a plot to be duplicated under
> a narrow set of circumstances.
> Here is a reproducible example.
> df1 <- data.frame(V1=rnorm(100))
> mtext("Test", side=1, line=4, adj=c(1,0)) # causes text to appear
If you do this:
mtext("Test", side=1, line=4, adj=seq(0,1, length=5) )
You get 5 items. It's arguably a "feature", and arguably documented where the help page says: "All of the named arguments can be vectors, and recycling will take place to plot as many strings as the longest of the vector arguments."
> This does not appear to happen if adj=c(0,0) or if the adj argument is
> removed altogether:
> mtext("Test", side=1, line=4, adj=c(0,0))
> Furthermore, it looks like using the "at" argument causes the spacing
> between the duplicated text to disappear:
> mtext("Test", side=1, line=4, at=0, adj=c(1,0))
> Some additional information related to my R installation.
> R version 3.2.3 (2015-12-10)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 8.1 x64 (build 9600)
>  LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
> States.1252 LC_MONETARY=English_United States.1252
>  LC_NUMERIC=C LC_TIME=English_United
> attached base packages:
>  stats graphics grDevices utils datasets methods base
> other attached packages:
>  rj_2.0.3-2
> loaded via a namespace (and not attached):
>  tools_3.2.3
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Alameda, CA, USA
More information about the R-help