[Rd] Wishlist: strwidth allow for rotation of text (PR#7931)

From: <epurdom_at_stanford.edu>
Date: Sat 11 Jun 2005 - 03:06:47 GMT


Hi,

This is not a bug, but an enhancement suggestion. "strwidth" only gives the width of the text according to the x-axis user coordinates, and similarly for "strheight". Even if the par setting "srt" is changed to rotate the text, the resulting width (resp. height) is in terms of the non-rotated text. Currently, if I want to know how much space to leave for vertical text in the user coordinates, I manually invert the user coordinates, and then change them back.

Even if arbitrary "srt" is too much, just having the option for 90 degree rotation would be helpful. If it were implemented for arbitrary srt, then I personally think it's x-axis and y-axis dimensions are of interest, and not the actual length of the rotated text.

I'm using R 2.1.0, Windows XP

Thanks,
Elizabeth Purdom

Example:
plot(1:100,seq(2,5,length=100), type="n") par("usr")
# [1] -2.96 103.96 1.88 5.12

strwidth("hello","user")
# [1] 7.613353

par(srt=90) #rotate 90 degrees
strwidth("hello","user") #still gives same width of text
# [1] 7.613353

par(usr=par("usr")[c(3,4,1,2)])
strwidth("hello","user")
# [1] 0.2307077



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Jun 11 13:10:07 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:09 GMT