Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: How do I put Arrow Heads on the ends of the Axis of my plots?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35598] Re: How do I put Arrow Heads on the ends of the Axis of my plots?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 22 Jul 2002 02:10:55 -0400 (EDT)
  • References: <ah8off$aru$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

David,
Here is a function that lets us do this to an already created graphics.
One of the catches that code deals with is that unless we specify PlotRange
numerically Mathematica will choose its own PlotRange that cannot be
predicted in advance.
Also, I  use a trick to load the package Graphics`Arrow at the right stage
when the function is entered and so that it will not be seen by a user when
?AddArrowsOnAxes is entered.


    AddArrowsToAxes[gr_, Needs["Graphics`Arrow`"] /. _ -> Sequence[],
          opts___?OptionQ] :=
        Module[{oxx, oyy, xxmin, xxmax, yymin, yymaxx, xxst, yyst,
            Arrow = Graphics`Arrow`Arrow },
             {{oxx, oyy}, {{xxmin, xxmax}, {yymin, yymax}}, {xxst, yyst}} =
            Last /@ AbsoluteOptions[
                Graphics[gr], {AxesOrigin, PlotRange, AxesStyle}];
            Show[gr, Prolog -> {Append[xxst,
                  Arrow[{xxmin, oyy}, {xxmax, oyy}, opts]],
                Append[yyst, Arrow[{oxx, yymin}, {oxx, yymax}, opts]]}]
        ];

Test:

    AddArrowsToAxes[gr1,HeadCenter->0.7] ;

    AddArrowsToAxes[gr1,Graphics`Arrow`HeadCenter->0.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


"david barens" <barnes at pullman.com> wrote in message
news:ah8off$aru$1 at smc.vnet.net...
> How do I put Arrow Heads on the ends of the Axis of my plots?
>
>




  • Prev by Date: Memory leak? Self-created non-executable Help notebook?
  • Next by Date: Re: Pattern Matching in Lists
  • Previous by thread: Re: How do I put Arrow Heads on the ends of the Axis of my plots?
  • Next by thread: data structure for sets