[R] text duplication bug in mtext?
murdoch.duncan at gmail.com
Fri Jan 1 22:56:49 CET 2016
On 01/01/2016 1:36 PM, Arkay 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.
As David said, this is a feature, not a bug.
You were probably confused by the different treatment of "adj" in text()
and mtext(). The former uses one or two values to determine placement
of all strings. The latter uses one value per string.
> 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
> 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.
More information about the R-help