Skip to content

axis() plot() - step

4 messages · Nolwenn Le Meur, Uwe Ligges, Ott Toomet +1 more

#
Hi,
Stupid question I guess but I can't figure out how to have a span of 0.5
instead of 1 in my graph.
Actually, I want to create a plot with x(-2,2) and y(-2,2) and an step of
0.5 along the axis.
Does somebody can help me ? Is it in par(), axis() or plot() that I have to
add something ?

Thanks
Nolwenn

*------------------------------------------*
Nolwenn Le Meur
INSERM U533
Facult? de M?decine
1, rue Gaston Veil
44035 Nantes cedex 1
t?l: +33(0)2-40-41-29-86
fax: +33(0)2-40-41-29-50
e-mail: nolwenn.lemeur at nantes.inserm.fr
*------------------------------------------*

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Nolwenn Le Meur wrote:
plot(..., xlim = c(-2, 2), ylim = c(-2,2), xaxt = "n", yaxt = "n") 
  axis(1, at = seq(-2, 2, 0.5))  
  axis(2, at = seq(-2, 2, 0.5))

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi,

I think the following example would help:

plot(-2:2,-2:2, xaxt="n", yaxt="n")
axis(1, at=seq(-2,2,by=0.5))
axis(2, at=seq(-2,2,by=0.5))

You have to specify *axt="n" in order to not draw them initially, and then
draw your own axis using at=c(whatever values you want the tickmarks to be
drawn).

Cheers,

Ott
On Fri, 23 Aug 2002, Nolwenn Le Meur wrote:
|Hi,
  |Stupid question I guess but I can't figure out how to have a span of 0.5
  |instead of 1 in my graph.
  |Actually, I want to create a plot with x(-2,2) and y(-2,2) and an step of
  |0.5 along the axis.
  |Does somebody can help me ? Is it in par(), axis() or plot() that I have to
  |add something ?
  |
  |Thanks
  |Nolwenn

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Ott> Hi,
    Ott> I think the following example would help:

    Ott> plot(-2:2,-2:2, xaxt="n", yaxt="n")
    Ott> axis(1, at=seq(-2,2,by=0.5))
    Ott> axis(2, at=seq(-2,2,by=0.5))

    Ott> You have to specify *axt="n" in order to not draw them
    Ott> initially, and then draw your own axis using
    Ott> at=c(whatever values you want the tickmarks to be drawn).

yes, if you want to be very explicit.
Another option would be to just say 
``I want more ticks, but R should still do them automatically''.
This is the case for using par(lab=)  something which I prefer
to completely specifying things.
Here :

op <- par(lab = c(10,10,7))
plot(-2:2, -2:2)
par(op) ## resetting to default par("lab")


Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._