[R] puzzled with plotmath II
Peter Ehlers
ehlers at ucalgary.ca
Thu Jan 20 14:17:22 CET 2011
On 2011-01-20 04:09, Gerrit Eichner wrote:
> Try
>
>> plot (1, 1, ylab = expression (Z[list(i,i)]))
>
> Hth -- Gerrit
>
>
>> -------- Original Message --------
>> Subject: puzzled with plotmath
>> Date: Thu, 20 Jan 2011 12:48:18 +0100
>> From: Claudia Beleites<cbeleites at units.it>
>> To: R Help<r-help at r-project.org>
>>
>> Dear all,
>>
>> I'm puzzled with matrix indices in plotmath.
>>
>> I'm plotting matrix elements: Z [i, i], and I'd like to put that as label.
>> I'll
>> describe what I want and what I get in LaTeX-notation.
>>
>> The output should look like Z_{i, i}, and my first try was
>> plot (1, 1, ylab = expression (Z[i, i]))
>>
>> That, however, gives me Z_{i} (no comma, no second i) although the expression
>> looks OK to me:
>>> a<- expression (Z[i, i])
>>> a [[1]]
>> Z[i, i]
>>> str (as.list (a [[1]]))
>> List of 4
>> $ : symbol [
>> $ : symbol Z
>> $ : symbol i
>> $ : symbol i
>>
>> I'm able to tweak the ouput looking as I want:
>> plot (1, 1, ylab = expression (Z[i][", "][i]))
>> which is, however, logically very far from what I want to express.
>>
>> What am I missing?
>>
>> I'm almost sure this has been discussed before, but I can't find it: can
>> anyone
>> point me to good search terms? Is it possible to search for the terms being
>> close to each other in RSiteSearch and/or RSeek? I get lots of introductory
>> documents as they point to plotmath and discuss matrices...
[snip]
Claudia,
Look for 'comma-separated list' on the help page!!
It will lead you directly to Gerrit's solution.
I would put a space in front of the first 'i' with
expression(Z[list(~i,i)])
or you can build it all up in pieces:
expression(Z[~i*","~i])
Peter Ehlers
More information about the R-help
mailing list