[R] Centering labels on X-axis

Rui Barradas ruipbarradas at sapo.pt
Fri Oct 19 19:24:48 CEST 2012


Hello,

Your working code needs a plot first:

plot(1:5, xaxt = "n")

And there's no 'text' argument to axis(). As for the centering of axis 
labels, they're centered on my graphics device. Exactly what is 
happening to yours?

 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Portuguese_Portugal.1252
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Portugal.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods base

other attached packages:
[1] ggplot2_0.9.2 igraph_0.6-2

loaded via a namespace (and not attached):
  [1] colorspace_1.1-1   dichromat_1.2-4    digest_0.5.2 fortunes_1.5-0
  [5] grid_2.15.1        gtable_0.1.1       labeling_0.1 MASS_7.3-21
  [9] memoise_0.1        munsell_0.3        plyr_1.7.1 proto_0.3-9.2
[13] RColorBrewer_1.0-5 reshape2_1.2.1     scales_0.2.2 stringr_0.6.1
[17] tools_2.15.1

Hope this helps,

Rui Barradas
Em 19-10-2012 15:39, YAddo escreveu:
> Dear all:
> I am trying to center labels on my plot with not much success. I have tried
> text(), mtext() but it's not working. I think I am using the wrong function
> for  my task.
>
>   Any help will be appreciated.
>
> My working codes.
> axis(1,
> at=c(1,2,3,4,5),font.lab=2,cex.axis=1.5,cex.lab=3,label=c("W0","CWH2","CWHmc","CH2","CHmc")
> ,text=c(1.5,2.5,3.5,4.5,5.5))
>
> Many thanks in advance
> YA
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Centering-labels-on-X-axis-tp4646761.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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