Re: Axes with arrowheads !?
- To: mathgroup at smc.vnet.net
- Subject: [mg65865] Re: [mg65582] Axes with arrowheads !?
- From: "David Turner" <dturner at faulkner.edu>
- Date: Wed, 19 Apr 2006 04:54:26 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I use the following: AddArrowsToAxes[gr, Needs["Graphics`Arrow`"]/._ -> Sequence[], opts___?OptionQ]:= Module[{oxx, oyy, xxmin, xxmax, yymin, yymax, 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]], Append[xxst, Arrow[{xxmax, oyy}, {xxmin, oyy}, opts]], Append[yyst, Arrow[{oxx, yymax}, {oxx, yymin}, opts]]}]] Four examples: Show[AddArrowsToAxes[Plot[(3*x - 12)/2, {x, -1, 5}, AxesLabel -> {"x", "y"}, DisplayFunction -> Identity], HeadCenter -> 0.7], DisplayFunction -> $DisplayFunction] Needs["Graphics`InequalityGraphics`"] IneqGr := AddArrowsToAxes[ InequalityPlot[3*x + 2*y <= 5, {x, -3, 3}, {y, -3, 3}, PlotRange -> {{-3.5, 3.5}, {-3.6, 3.6}}, Fills -> {GrayLevel[0.775]}, DisplayFunction -> Identity], HeadCenter -> 0.7]; Bndy := Graphics[{AbsoluteThickness[2], Line[{{-1/3, 3},{3, -2}}]}, Axes -> True, AxesFront -> True] Show[IneqGr, Bndy, AxesLabel -> {"x", "y"}, DisplayFunction -> $DisplayFunction] Needs["Graphics`ImplicitPlot`"] Show[AddArrowsToAxes[ ImplicitPlot[y^2 == x^3 - 4*x^2 + 16, {x, -2, 5}, Ticks -> {{-1.679, 8/3}, {-4, 4}}, DisplayFunction -> Identity], HeadCenter -> 0.7], AxesLabel -> {"x", "y"}, DisplayFunction -> $DisplayFunction] Needs["Graphics`Graphics`"] Show[AddArrowsToAxes[PolarPlot[2 + 5*Cos[t], {t, 0, 2*Pi}, PlotRange -> {{-1, 8}, All}, DisplayFunction -> Identity], HeadCenter -> 0.7], AxesLabel -> {"x", "y"}, Ticks -> {{1, 3, 5, 7}, {-2, 2}}, DisplayFunction -> $DisplayFunction] The code for AddArrowsToAxes is not mine. I do not remember where I obtained it. David