[R] questions about axis
Ko-Kang Kevin Wang
kwan022 at stat.auckland.ac.nz
Wed Oct 22 09:04:39 CEST 2003
Hi,
On Wed, 22 Oct 2003, yyh wrote:
> I have difficulties to handle axis. I want to draw axis label such that axis has range of [-0.4,0.4] with intervel 0.2 for x and y axis.
> Some part of range do not have data points. Thus, plot does not show whole range. How can I enforce plot to depict the whole range regardless of existence of data points ?
You can draw the plot from first principle. For example:
x = seq(-0.4, 0.4, length = 50)
y = runif(50, -0.2, 0.2)
plot.new()
plot.window(xlim = c(-0.4, 0.4), ylim = c(-0.4, 0.4))
axis(1, at = seq(-0.4, 0.4, by = 0.2))
axis(2, at = seq(-0.4, 0.4, by = 0.2))
points(x, y)
box()
> Another problem is that when I depict axis labels, some labels are overlapped because interval is very small. In this case, I'd like to put one of label into insde the box which is drawn by plot.
> How can I do this ?
Try:
title(xlab = "This is my x-label", line = -2)
Of course, this is just a silly example, with 50 uniform random numbers
between -0.2 and 0.2. But you get the idea...
--
Cheers,
Kevin
---------------------------------------------------------------
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)
More information about the R-help
mailing list