2

I can't find anything anywhere on the web to help me with this.

My plot:

Plot[{(u (u + d) (1 - u))/u, u, 0}, {u, 0, 1}, 
 PlotStyle -> {Orange, Green, Green}, PlotRange -> {-0.1, 1}, 
 Frame -> True, Axes -> None, GridLines -> {{0}, {}}, 
 GridLinesStyle -> Directive[Green]]

I would like to be able to put vertical arrows on the orange lines and horizontal arrows horizontal arrows on the green curve.

If it helps, this is a plot of the nullclines of a system of ODEs and i need to draw the direction of the arrows of the vector field on each nullclines.

eldo
  • 67,911
  • 5
  • 60
  • 168
user146338
  • 23
  • 2
  • please observe that you haven't defined "d". Which values do you want "d" to assume? – eldo Jun 01 '14 at 15:54

1 Answers1

6

Two alternatives:

Either post-process the output of Plot to modify the graphics primitives and directives:

 Plot[{(u (u + 2) (1 - u))/u, u, 0}, {u, 0, 1}, 
    PlotStyle -> {Orange, Green, Green}, PlotRange -> {-0.1, 1}, 
   Frame -> True, Axes -> None, GridLines -> {{0}, {}}, 
   GridLinesStyle ->  Directive[ Green]] /. 
         Line[x__] :> Sequence[Arrowheads -> Table[.025, {5}], Arrow[x]]

enter image description here

or, alternatively, use the following special setting for PlotStyle:

 Plot[{(u (u + 2) (1 - u))/u, u, 0}, {u, 0, 1}, 
  PlotStyle -> Thread[{{Orange, Green, Green}, 
                        Arrowheads[Table[.05, {5}]], (Arrow @@ ## &)}], 
     PlotRange -> {-0.1, 1}, Frame -> True, Axes -> None, 
     GridLines -> {{0}, {}}, GridLinesStyle -> Green]

Update: A simpler variant of the latter is using BaseStyle to change the default value for Arrowheads and post-process Lines into Arrows:

  Plot[{(u (u + 2) (1 - u))/u, u, 0}, {u, 0, 1}, 
   BaseStyle -> Arrowheads[Table[.05, {5}]], 
   PlotStyle -> {Orange, Green, Green}, PlotRange -> {-0.1, 1}, 
   Frame -> True, Axes -> None, GridLines -> {{0}, {}}, 
   GridLinesStyle -> Green] /. Line -> Arrow
kglr
  • 394,356
  • 18
  • 477
  • 896