0

I have a plot in R with both x and y-axes tick labels looking like this:

-1.5 -1.0 -0.5 0.0 0.5 1.0
  1. How can I remove the -1.5, -0.5, 0.5 tickmarks/labels?

  2. How can I remove the decimal from the remaining labels? (i.e. -1.0 to become -1).

lmo
  • 37,904
  • 9
  • 56
  • 69
VasoGene
  • 141
  • 3
  • 12
  • Hi, welcome to SO. Please read up on how to provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and edit your post accordingly. – Heroka Sep 16 '15 at 15:20

1 Answers1

1

So, a plot like this is what I hear you describing:

plot(seq(-1.5, 1.1, 0.5),seq(-1.5, 1, 0.5))

Adding the xaxp and yaxp vectors will let you fine-tune the labeling:

plot(seq(-1.5, 1.1, 0.5),seq(-1.5, 1, 0.5), xaxp=c(-1,1,2), yaxp=c(-1,1,2))

The input to xaxp is "A vector of the form c(x1, x2, n) giving the coordinates of the extreme tick marks and the number of intervals between tick-marks when par("xlog") is false." See the help page for par{graphics} for more details

A plot with integer axis labels

Ron Jensen
  • 641
  • 7
  • 20