Re: [R] Arrow heads at the end of axes

From: Marc Schwartz <MSchwartz_at_medanalytics.com>
Date: Fri 22 Oct 2004 - 00:27:40 EST

On Thu, 2004-10-21 at 09:04, Henrik Andersson wrote:
> 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

Hope That Helps

A common internet acronym that I suppose we take for granted sometimes.

I had also looked at the possible plot symbols as an alternative. You could use 'pch = 2' (or 17 or 24) for the y axis (an upward pointing triangle). However, there is really not an equivalent "side pointing" triangle for the x axis.

polygon() is certainly an alternative.

Best regards,

Marc



R-help@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 Received on Fri Oct 22 05:24:59 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:58:12 EST