[R] Vertical labels on axes overlap

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Jan 6 10:07:03 CET 2005


Tomas Kalibera wrote:
> 
> Hello,
> 
> when using horizontal labels (default) in plots on x-axis, R by default 
> selects a subset of labels to plot so that the labels do not overlap. 
> However, when using vertical labels, all labels are always drawn, even 
> when they overlap. Is it a bug or do I have to adjust some magic 
> parameter ?
> 
> the problem can be shown on these 2 tiny examples:
> 
> horizontal labels (default) [OK]:
> 
>  > plot(1:100,axes=FALSE)
>  > axis(1,at=1:100,labels=rep("aaa",100))
> 
> (only a subset of labels is drawn)
> 
> vertical labels [THE PROBLEM]:
> 
>  > plot(1:100,axes=FALSE)
>  > axis(1,at=1:100,labels=rep("aaa",100),las=2)
> 
> (all labels are drawn - and they do overlap)

I think it does not qualify as a bug, because you might want to allow a 
small amount of overlapping if you are already plotting vertically.
Instead, you have select each second/third element yourself, in this 
case most easily with:

  plot(1:100,axes=FALSE)
  axis(1,at=1:100,labels=rep(c("aaa", ""),50),las=2)


Uwe Ligges



> Thanks,
> 
> Tomas
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list