Michi,

Try putting your par() statements BEFORE your barplot() statement.  For 
example,

oldpar <- par(mar=c(18, 7, 2, 2.1)) 
oldfont <- par(font=3) 
bp <- barplot(data.matrix(geo_barplot_percentage_top10), 

...

Jean


Michael Eisenring <eimic...@ethz.ch> wrote on 09/06/2012 12:40:27 PM:
> 
> Dear R-help members,
> with the help of one of you the following R-Code was developed. No I
> have the (probably simple) problem that I want to increase font size
> of "text" and "ylab" names  from 1 to 2. Unfortunately I'm not able 
> to adjust the margin so, that the plot is appers complete (all names
> readable) on a 8:14 Inch scale plot. 
> Some times I get the error message that the margin borders are to 
> big (if I increase the oldpar value), sometimes nothing happens , I 
> have no clue why. Can anyone help me? 
> Thank you
> Michi 
> 
> 
> 
> 
> 
> 
> 
> 
> 
------------------------------------------------------------------------------
> R CODE
> 
------------------------------------------------------------------------------
> dput(geo_barplot_percentage_top10)
> 
> geo_barplot_percentage_top10 <- structure(list(young = c(43L, 7L, 
> 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L), old = c(21L,9L, 4L, 3L, 3L, 3L, 2L,
> 2L, 2L, 2L)), .Names = c("young", "old"), class = "data.frame", 
> row.names = c(NA, -10L))
> 
>  
> bp <- barplot(data.matrix(geo_barplot_percentage_top10),
>               width = 1,
>               ylim = c(0,50),
>               xaxt = "n",
>               space = c(0.2, 1.0), 
>               ylab = "Relative frequencies (%)",
>               beside = TRUE,
>               col = rep(c("orange", "red"), each=10),
>               cex.names = 2)
> oldpar <- par(mar=c(18, 7, 2, 2.1))
> oldfont <- par(font=3)
> 
>   names.arg = rep(as.character(1), 3))
> text(as.vector(bp),y=-1, cex=2,pos = 2, 
>      offset = -0.1,
>      labels = c("Asthenotricha cf. unipecten 1","Asthenotricha cf. 
> unipecten 2","Cleora cf. pavlitzkiae","Omphalucha cf. 
> apira","Asthenotricha sp. 6","Prasinocyma cf. 
> neglecta","Asthenotricha sp. 5","Scopula cf. cauducaria","Zamarada 
> cf. melpomene","Eois cf. oressigenes","Asthenotricha cf. unipecten 
> 1","Asthenotricha cf. unipecten 2","Asthenotricha sp. 
> 6","Asthenotricha sp. 5","Cleora cf. pavlitzkiae","Colocleora cf. 
> polyplanes","Miantochora cf. fletcheri 3","Miantochora cf. fletcheri
> 1","Pingasa cf. rufata","Xanthisthisa cf. tarsispina")
>      ,srt = 50,xpd = TRUE)#srt=text rotation
> 
> legend.width <- max(strwidth(c("Young secondary forest","Old 
> secondary forest")))
> par(oldfont)   # back to normal font for legend
> legend(14,62,
>        c("Young secondary forest","Old secondary forest"),
>        cex=1.5, pt.cex=4, pch=15, y.intersp=0.15,bty="n",
>        text.width = legend.width/2.5, 
>        col=c("orange","red"))
> #8:14 Scale of graph! 

        [[alternative HTML version deleted]]

______________________________________________
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