[R] Underlined font
Uwe Ligges
ligges at statistik.uni-dortmund.de
Fri Jan 18 22:31:19 CET 2002
David Brahm wrote:
>
> Hi all,
>
> Is there a simple way to place underlined text in a plot?
>
> Hershey vector fonts seem to have a single underscore character ("\\ul"),
> but no underlined font. Plotmath (ref: ?plotmath) comes very close with:
> R> plot(0:1,0:1, type="n")
> R> text(.1, .1, quote(bar(Hello)))
> but that's overlined, not underlined. Also:
> R> text(.2, .2, quote(over(Hello, phantom())))
> is the right idea but leaves too much space. Thanks for any help!
Don't know a nice solution, but as a workaround you can underline the
text() yourself, e.g. with the following (quickly hacked) function:
underlined <- function(x, y, label, ...){
text(x, y, label, ...)
sw <- strwidth(label)
sh <- strheight(label)
lines(x + c(-sw/2, sw/2), rep(y - 1.5*sh/2, 2))
}
plot(0:1, 0:1, type="n")
underlined(0.1, 0.1, "Hello")
Uwe
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list