[R] Arrow heads at the end of axes

Henrik Andersson h.andersson at nioo.knaw.nl
Thu Oct 21 16:04:09 CEST 2004

Marc Schwartz wrote:

> On Thu, 2004-10-21 at 07:12, Henrik Andersson wrote:
>>I would like to have arrow heads at the end of my axes, since I am 
>>plotting variable where the absolute amount is irrelevant, there is not 
>>supposed to be numbers on the axes.
> You can do something like this:
> plot(rnorm(10), axes = FALSE)
> # Get the axis ranges
> u <- par("usr")
> # Use arrows() to draw the axis lines, adding the arrowheads
> # Use the par("usr") values to specify the end points of the lines
> # Setting 'xpd = TRUE' allows for the arrowhead to be drawn outside
> # the plot region as required here
> arrows(u[1], u[3], u[2], u[3], code = 2, xpd = TRUE)
> arrows(u[1], u[3], u[1], u[4], code = 2, xpd = TRUE)
> See ?arrows for additional options to define the arrows.
> HTH,
> Marc Schwartz

Thanks for pointing the direction (seriously), the looks of the 
arrowheads could still use some improvements, so I used a polygon to 
draw an arrowhead which thanks to your suggestion was possible outside 
the plot region.

Is it my Internet English or normal English that is bad, but was is the 
expansion of 'HTH' ?

Cheers, Henrik

More information about the R-help mailing list