2
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ please observe that you haven't defined "d". Which values do you want "d" to assume? $\endgroup$ – eldo Jun 1 '14 at 15:54
5
$\begingroup$

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
$\endgroup$
  • $\begingroup$ Great! Just what I was looking for! $\endgroup$ – user146338 Jun 1 '14 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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