Hi Andrew,
If I understand correctly, then

# Data
x <- c(3,4,2)

# Collection of text and symbols
Text <- c('foo', 'abcd', 'John')
PCH <- c('+','O','$')

# Plotting
plot(x, pch = PCH)
legend('topright', pch = PCH, Text, ncol = 3)

should be close to what you want. Note that the text() / points()
combination could be avoided when using legend().

Best,

Jorge


On Thu, Jul 9, 2009 at 11:08 AM, Andrew Yee <> wrote:

> Thanks for your help.
> I should have been more clear in my initial e-mail.  I shouldn't have used
> 'alpha' or 'beta,' to avoid confusion with them as Greek symbols.  I should
> have stated something like:
>
> O foo O abcd O John
>
> While I'm familiar with using legend to make the filled boxes, I'm
> interested in creating a one line "legend" of sorts, but manually using
> text() with both data symbols defined by pch and text on the same line.  Or
> is this not possible?  I guess at the end of the day, I could use both
> points() and text().
>
> Thanks,
> Andrew
>
> On Thu, Jul 9, 2009 at 11:03 AM, Jorge Ivan Velez <> wrote:
>
>> Hi Andrew,
>> Do you want to put the symbols you described as a legend in a plot?  If
>> so, here is one way:
>>
>> x <- rnorm(3)
>> plot(x, pch = 16, cex = 1.1, col = 1:3)
>> legend('topleft', ncol = 3,
>>         c(expression(alpha), expression(beta), expression(gamma)), pch =
>> 16, cex = 1.1, col = 1:3)
>>
>> Is you do not want to use legend, but place the symbols in each plot,
>> then:
>>
>> plot(x, pch = 16, cex = 1.1, col = 1:3)
>> text(1.05,1.01*x[1], expression(alpha) )
>> text(2.05,1.01*x[2], expression(beta) )
>> text(2.95,1.01*x[3], expression(gamma) )
>>
>> should get you close.
>>
>> See ?text, ?expression and ?legend for more information.
>>
>> HTH,
>>
>> Jorge
>>
>>
>>  On Thu, Jul 9, 2009 at 10:53 AM, Andrew Yee <> wrote:
>>
>>>  Hi, is there a way to treat a data symbol, e.g. one with pch = 16, as a
>>> character?
>>> Specifically, I'm interested in creating a line of text as follows using
>>> the
>>> text() function
>>>
>>> O alpha O beta O gamma
>>>
>>> where the "O" is pch 16 and filled with a specific color.
>>>
>>> Not sure if this is possible or not.
>>>
>>> Thanks,
>>> Andrew
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to