Why do you take 2.54? I think you forgot a bracket...

#par(mar = c(max(strwidth(names(x)) * 2.54, 4,4,2))
#
#should be
par(mar = c(max(strwidth(names(x))) * 2.54, 4,4,5))

#and 5 would be a better value. But this is merely trial and error?!

Regards

Thomas Kaliwe


Henrique Dallazuanna schrieb:
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 <hamstersqu...@web.de <mailto:hamstersqu...@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 <mailto: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

______________________________________________
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