MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Arrows on axes?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27268] Re: Arrows on axes?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sun, 18 Feb 2001 02:52:06 -0500 (EST)
  • References: <96ldi4$guc@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Vitalij
Essentiall, find where the ends of the axes are and use the package
Graphics` Arrow`

Here is an automation of this from my column How and Why in Mathematica in
Education and Research 8.4

Programming note: the package,  Graphics`Arrow`, is loaded internally by the
function defined below, so we have to use  the long name
Graphics`Arrow`Arrow .rather than just Arrow. This is because contexts are
assigned before evaluation, so Arrow would be given the current context,
usually "Global`", and would not access the package definitions (we would
get a message like when we enter Arrow before loading the package).
Options are passed on to Arrow.

ArrowsOnAxes[gr_, opts___?OptionQ]:=
 Module[{ox,oy,xmin, xmax,ymin,ymax, xst,yst},
 Needs["Graphics`Arrow`"];
 {{ox,oy},{{xmin, xmax},{ymin,ymax}},{xst,yst}}=
       Last/@
        AbsoluteOptions[Graphics[gr], {AxesOrigin, PlotRange, AxesStyle}];
     Show[gr,
       Prolog->{
           Append[xst,
            Graphics`Arrow`Arrow[{xmin,oy}, {xmax,oy},opts]],
           Append[yst,
            Graphics`Arrow`Arrow[{ox,ymin}, {ox,ymax}, opts]]}
       ]
    ];

gr1=Plot[Sin[x],{x,0, 7},
 AxesStyle-> Hue[0]];

ArrowsOnAxes[gr1, HeadCenter\[Rule].7];

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Vitalij K. Lysoff" <lysov at paloma.spbu.ru> wrote in message
news:96ldi4$guc at smc.vnet.net...
> Hello, All!
> How to draw arrows at ends of axes?
>




  • Prev by Date: Comparing Numbers - improving on log relative error
  • Next by Date: Re: two y-axis
  • Previous by thread: Re: Arrows on axes?
  • Next by thread: Re: Arrows on axes?