Try this:
par(mar = c(max(strwidth(names(x)) * 2.54, 4,4,2))
barplot(x, las = 3)
On Mon, Jan 5, 2009 at 2:15 PM, Thomas Kaliwe <hamstersquats@web.de>
wrote:
> Dear members,
>
> Is there a way to turn a strwidth of a string into a number of lines that
> ist needed to display the string when using par(mar = c(?,4,4,2))
>
> ####
> x = 1:5
> names(x) =
c("ZZZZZ","ZZZZZzzzzz","ZZZlllll","TTTTT","Zzhtsddfg"
)
> par(mfrow = c(1,2))
> par(mar = c(8,4,4,2))
> barplot(x, las = 3, main = "8 is to much")
> par(mar = c(4,4,4,2))
> barplot(x, las = 3, main = "4 is not enough")
> ###
>
>
> strwidth2lines...
>
>
> regards
>
> Thomas Kaliwe
>
> ______________________________________________
> 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
[[alternative HTML version deleted]]