[R] Label using equivalent of \mathbb{R}
Deepayan Sarkar
deepayan at stat.wisc.edu
Thu Aug 26 19:29:01 CEST 2004
On Thursday 26 August 2004 11:41, Martin Maechler wrote:
> >>>>> "Simon" == Simon Cullen <cullens at tcd.ie>
> >>>>> on Thu, 26 Aug 2004 15:30:06 +0100 writes:
>
> Simon> On Thu, 26 Aug 2004 15:24:33 +0200, Trenkler,
> Simon> Dietrich <dtrenkler at nts6.oec.uni-osnabrueck.de>
>
> Simon> wrote:
> >> [Dietrich Trenkler]
> >>
> >>
> >> plot(rnorm(10),xlab=expression(bold(x)),ylab=expression(bold(y)))
>
> Simon> Not quite what I am looking for, I'm afraid. \mathbb
> Simon> gives "blackboard" fonts - the capitals with two
> Simon> vertical parallel lines in them that are used for the
> Simon> Reals, Complex numbers etc.
>
> yes (and Dieter confused \mathbb{} with \mathbf{}).
>
> R's builtin plotmath utilities can't do this directly.
> A workaround would be similar to what we used to do in LaTeX 2.09
> times (before \mathbb{} was standardly available):
>
> { "I", <negative space>, "R" }
>
> Whereas with (La)TeX, a macro definition was relatively
> easy for the above, it might be a bit harder / more ugly with
> current R builtins, for one because I don't think ``plotmath''
> has a concept of <negative space>.
> 1) A really ugly hack would work with text() -- not quite useful
> if you'd like these in 'xlab' etc.
>
> 2) A potentially much nicer scheme might be to use "grid" instead of
> oldstyle "graphics" : There one could construct a "grob"
> (graphical object) for the '|R' symbol that one could should be
> pass to other functions -- though it may need some tweaking
> before a function like (pkg lattice's) xyplot() would accept
> a grob for xlab [instead of only a character or expression].
Interesting thought. Should be almost trivial to implement.
Currently, legends (sort of generalized key-s in the Trellis context) can be
grobs, e.g.
bbR <- textGrob(c("I", "R"), x = 0.7 * c(-1, 1),
default.units = "mm",
vp = viewport(h=0, w=0))
xyplot(1 ~ 1, xlab = NULL, legend = list(bottom = list(fun = bbR)))
Deepayan
More information about the R-help
mailing list