[R] [Q] Format of a plot axis label

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 7 17:34:12 CEST 2006

Do you mean the axis tick annotations, the xlab, the ylab or what? (It is 
the xlab and ylab that are quite explicitly called 'axis label' in the 

If you mean the axis tick annotations, please show us an example where R 
uses an unnecessary (in your view) '.0'.  The internal code uses the same 
algorithm as print.default(), and so will use the same number of decimal 
places for all the annotations on one (non-log-scale) axis.

R is very programmable, and you can use par(xaxt="n") followed by a call 
to axis(1) specifying at= and label= to get precisely what you want for 
the x axis (amend in the obvious way for the y axis).

On Fri, 7 Apr 2006, Young-Jin Lee wrote:

> Dear R-users
> Can anyone please tell me how to format a label of a plot?
> I found that R uses a floating point number (e.g. 2.0) sometimes and an
> integer number (e.g. 2) other times in lables of a plot even though no
> floating number is needed to show the lables.
> How can I get R to use only integer numbers in the plot labels?
> Thanks in advance.
> Young-Jin
> 	[[alternative HTML version deleted]]
> ______________________________________________
> 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

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list