[R] Rotating characters in text

David Winsemius dwinsemius at comcast.net
Wed Jun 13 00:01:53 CEST 2012


On Jun 12, 2012, at 4:02 PM, Greg Snow wrote:

> If you insert `\n` between each letter, then it should do what you
> want with a single call to text or mtext.  To expand on David's
> example:
>
> plot(1:10)
> text(5,5, paste( strsplit(txvec, ''), collapse='\n') )
>

In fact it could be made even easier:

(Copied from you original.)

txvec <- c("L
i
k
e

t
h
i
s
.")
  plot(1,1)
  text(0.8, 1, labels=txvec)


--  
David.
>
>
> On Tue, Jun 12, 2012 at 10:16 AM, David Winsemius
> <dwinsemius at comcast.net> wrote:
>>
>> On Jun 12, 2012, at 9:49 AM, Stuart Rosen wrote:
>>
>>> For labelling a plot, I am trying to rotate a character string using
>>> text() so that characters are upright and reading down, for  
>>> example, ...
>>>
>>> L
>>> i
>>> k
>>> e
>>>
>>> t
>>> h
>>> i
>>> s
>>> .
>>>
>>> It appears that par crt does not work with text. Does anyone have  
>>> any
>>> other suggestions.
>>
>>
>> Just print the letters separately. Something like this untested use  
>> of
>> `mapply`:
>>
>> mapply(text, labels=strsplit(txvec, ""),
>>        x=1,  # or some other appropriate number, should get recycled.
>>        y=seq(start, end, length=nchar(txvec) )
>>
>> --
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>> ______________________________________________
>> R-help at 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.
>
>
>
> -- 
> Gregory (Greg) L. Snow Ph.D.
> 538280 at gmail.com

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list