[R] Adjust the distance between tick mark labels and axis

Peter Ehlers ehlers at ucalgary.ca
Fri Mar 11 02:28:02 CET 2011


On 2011-03-10 11:37, Al Roark wrote:
>
> Hi all:
>
> I've been trying to figure out a way to move the tick mark labels
> in my lattice plots closer to the the axes. I've tinkered with a
> lot of the "buffer" parameters (those listed by
> trellis.par.get()), but haven't had any luck. Any ideas?

If I understand correctly what you want, you need to
adjust the axis.components list, specifically the
'pad1' and 'pad2' values for the bottom/left/top/right
axes. If you keep the sum pad1 + pad2 = 2, then the
plot will retain your xlab/ylab at the default position.

Here's an example:

   require(lattice)
   myadj <- 0.1
   p <-
   xyplot(Sepal.Length ~ Sepal.Width | Species
     ,data = iris
     ,par.settings = list(
        axis.components = list(
           left   = list(pad1 = myadj, pad2 = 2 - myadj)
          ,bottom = list(pad1 = myadj, pad2 = 2 - myadj)
          ,top    = list(pad1 = myadj, pad2 = 2 - myadj)
          ,right  = list(pad1 = myadj, pad2 = 2 - myadj)
        )
      )
   )
   print(p)


Peter Ehlers

>
> Cheers. 		 	   		
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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