Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have figures containing several arcs showing the extend of angular measures, and would like to indicate the directions in which angles are measured with arrowheads. How do I add an arrowhead at the "ends" of these arcs? (The "arrowheads" panel in the drawing tools palette is, worryingly, disabled.)

For example, I have something like this to start with:

enter image description here


Show[
 Graphics[{Red, Circle[{0, 0}, 1, {0 Degree, 90 Degree}]}],
 Graphics[{Blue, Circle[{0, 0}, 1.25, {0 Degree, 270 Degree}]}],
 Graphics[{Green, Circle[{0, 0}, 1.5, {0 Degree, 180 Degree}]}]]
share|improve this question
    
Does this help: mathematica.stackexchange.com/questions/11545/… –  s0rce Oct 23 '12 at 22:31
    
All I can come up with is something like Graphics[Arrow[ BezierCurve[{Sin[#], Cos[#]} & /@ Range[0, Pi, .01]]]]. That can't be the right approach, can it? –  raxacoricofallapatorius Oct 23 '12 at 22:47
1  
Since Arrow[] can take BSplineCurve[] arguments, you can use the functions in this question to get circular arcs with arrow heads. Witness for instance Arrow[BSplineCurve[{{1, 0}, {1, Sqrt[3]}, {-1/2, Sqrt[3]/2}}, SplineDegree -> 2, SplineKnots -> {0, 0, 0, 1, 1, 1}, SplineWeights -> {1, 1/2, 1}]] // Graphics –  J. M. Oct 23 '12 at 23:40
1  
Possible duplicate: stackoverflow.com/questions/5705243/… –  David Carraher Oct 24 '12 at 4:29

2 Answers 2

up vote 14 down vote accepted
 Show[ParametricPlot[#[[1]]*{Cos[\[Theta]],Sin[\[Theta]]}, {\[Theta], #[[2]], #[[3]]},
    Axes -> False, PlotStyle -> #[[4]]] /.
  Line[x_] :> Sequence[Arrowheads[{-0.05, 0.05}], Arrow[x]] & /@ 
   {{1, 0 Degree, 90 Degree, Red}, {1.25, 0 Degree, 270 Degree, Blue},
    {1.5, 0 Degree, 180 Degree, Green}},
 PlotRange -> All]

enter image description here

Update: A function using a single ParametricPlot with multiple circles with arrows:

 ClearAll[arcsWArrows];
 arcsWArrows[args1 : {{_, {_, _}} ..}, dir_List: {Directive[GrayLevel[.3], 
 Arrowheads[{{-0.05, 0}, {0.05, 1}}]]}] :=
   ParametricPlot[ Evaluate[#[[1]]*{ Cos[Rescale[u, {0, 2 Pi}, Abs@#[[2]]]], 
     Sin[Rescale[u, {0, 2 Pi}, Abs@#[[2]]]]} & /@ args1],
    {u, 0, 2 Pi}, PlotStyle -> dir, Axes -> False,
     PlotRangePadding -> .2, ImageSize -> 200] /. 
  Line[x_, ___] :> Arrow[x]

Usage:

rdsAndAngls = {{1, {0, \[Pi]/2}}, {1.25, {0, \[Pi]}}, {1.5, {0, ( 3 \[Pi])/2}}, 
     {2, { \[Pi]/4, ( 4 \[Pi])/2}}};
directives = {Directive[Red, Thick,  Arrowheads[{{-0.05, 0}, {0.05, 1}}]],
    Directive[Blue, Dashed, Arrowheads[{{-0.05, 0}, {0.05, 1}}]],
    Directive[Green, Arrowheads[{{-0.05, 0}, {0.05, 1}}]],
    Directive[Orange, Thickness[.02],  Arrowheads[{{-0.07, 0}, {0.07, 1}}]]};

Row[{arcsWArrows[rdsAndAngls], 
       arcsWArrows[rdsAndAngls, {directives[[1]]}],
       arcsWArrows[rdsAndAngls, directives], 
       arcsWArrows[rdsAndAngls, directives[[-1 ;; 2 ;; -1]]]}]

enter image description here

share|improve this answer

You can approximate a Circle with a Line or Arrow, if reasonable resolution is given:

Circle[o_, r_, {a_, b_}] -> Arrow@Table[{Cos[k], Sin[k]}*r + o, {k, a, b, (b-a)/res}]

where res gives the resolution of the line. The replacement can be done at the first call of Graphics on the arguments or even after, on the InputForm version of the resulting figure.

To see it in action:

Manipulate[
 pts = N@Table[{Cos[k], Sin[k]}*r + o, {k, α Degree, β Degree, (β Degree - α Degree)/d}];
 Show[
  Graphics[{Lighter@Pink, AbsoluteThickness@10, Circle[o, r, {α Degree, β Degree}]}],
  Graphics[{Arrow[pts, 0]}],
  PlotRange -> {{-1.3, 1.3}, {-1.3, 1.3}}, AspectRatio -> 1, 
  Axes -> True, ImageSize -> 250
 ],
 {{d, 20, "res."}, 1, 100, Appearance -> "Labeled"},
 {{α, 0, "α"}, 0, 360, Appearance -> "Labeled"},
 {{β, 250, "β"}, 0, 360, Appearance -> "Labeled"},
 {{r, 1, "r"}, 0.01, 2, Appearance -> "Labeled"},
 {{o, {0, 0}, "origo"}, {-1, -1}, {1, 1}},
 ControlPlacement -> Left
]

Mathematica graphics

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.