[R] Including a tilde in a plotmath-type call
Patrick Connolly
p_connolly at slingshot.co.nz
Fri May 30 09:59:22 CEST 2008
On Thu, 29-May-2008 at 11:25PM -0400, Charilaos Skiadas wrote:
>
> On May 29, 2008, at 11:02 PM, p_connolly at slingshot.co.nz wrote:
>
>> Suppose I have a plot
>> plot(1:10, pch = "")
>>
>> And I want some text to indicate a Normal distrubition. I could do
>> this:
>>
>> text(5, 6, substitute(X~~~~N(mu, sigma^2)), adj = 0)
>> text(5.35, 6, "~", adj = 0)
>>
>> But that's clumsy, and depending on your plotting device, might not even
>> look
>> sensible. I'd prefer to be able to do it more directly and
>> simply the way these do:
>>
>> text(5, 1, expression(X %~~% N(mu, sigma^2)), adj = 0)
>> text(5, 2, expression(X %prop% N(mu, sigma^2)), adj = 0)
>> text(5, 3, expression(X %=~% N(mu, sigma^2)), adj = 0)
>>
>> They're easy, but they don't give a single tilde. I know how to put a
>> tilde(X) or even a wide tilde, but there're not it either.
>>
>> What did I miss?
>>
>
> Does this do it?
>
> text(2, 3, expression(X *"~"* N(mu, sigma^2)), adj = 0)
Great! That's exactly what I needed to know. Where did you find
that? It's not in the FAQ, nor the help for plotmath. I tried all
manner of variations using '%', but never had a hint that the '*'
character could be used like that.
--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
___ Patrick Connolly
{~._.~} Great minds discuss ideas
_( Y )_ Middle minds discuss events
(:_~*~_:) Small minds discuss people
(_)-(_) ..... Anon
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
More information about the R-help
mailing list