[R] Vertical string with horizontal letters

Tyler Rinker tyler_rinker at hotmail.com
Thu Feb 2 19:08:17 CET 2012



One possible solution is to use strsplit to break on each character and then paste to put in a "\n" after each character.  Then when you plot the text should be in the format you desire.
x <- "output"y <- unlist(strsplit(x, NULL))p <- cat(paste(y, collapse="\n"))
plot.new()text(.5, .5, paste(y, collapse="\n"))

cheersTyler----------------------------------------
> From: israelbyrd at hotmail.com
> To: r-help at r-project.org
> Date: Thu, 2 Feb 2012 17:20:17 +0000
> Subject: [R] Vertical string with horizontal letters
>
>
> I'm trying to format text on a plot such that the string is vertical but the letters are horizonal. I tried
> text(1,1,label="output", srt=270)
> This gives the string rotation I want, but that rotates the entire "output" so the letters are also rotated. I've also tried
> text(1,1,label="output", srt=270, crt=270)
> to no avail. par()$crt doesn't seem to affect text? The format I want is demonstrated below:
>
> o
> u
> t
> p
> u
> t
>
> Thanks.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
 		 	   		  


More information about the R-help mailing list