I'm looking to visualize slope fields of differential equations for my differential equations course. Every example I see draws them as vectors, adding unnecessary "arrows" that, to me, are visually distracting. Is there a way to plot these slope fields without the "arrows" that get in the way?

  • $\begingroup$ LineIntegralConvolutionPlot[{y, x - x^3 - 0.3 y + 0.5 Cos[3.125]}, {x, -2.5, 2.5}, {y, -2.5, 2.5}, ColorFunction -> ColorData["DeepSeaColors"], StreamPoints -> 10, StreamStyle -> {"Line", Thick, White}] $\endgroup$
    – Sektor
    Commented Mar 5, 2014 at 21:28
  • $\begingroup$ possible duplicate of Visualizing a Complex Vector Field near Poles $\endgroup$
    – m_goldberg
    Commented Mar 5, 2014 at 22:22

2 Answers 2


You can use the options VectorScale and VectorStyle of VectorPlot. To create the slope field for the first order equation $y'=f(x,y)$, I usually do something like so.

f = Exp[-x] - y;
VectorPlot[{1, f}, {x, -2, 2}, {y, -2, 2},
  VectorScale -> {0.03, Automatic, None},
  VectorStyle -> {Gray, Arrowheads[0]}]

enter image description here


Yes, you can simply replace each occurrence of Arrow with Line like this:

VectorPlot[{y, -x}, {x, -3, 3}, {y, -3, 3}] /. Arrow -> Line


To understand how this works, please read the documentation for ReplaceAll and also take a look at FullForm[VectorPlot[...]]. The point is to see that the plot is just a bunch of graphics directives and therefore we can modify it. Replacing Arrow with Line works because the argument is the same to both Arrow and Line.

You can also achieve it like this:

VectorPlot[{y, -x}, {x, -3, 3}, {y, -3, 3}, VectorStyle -> "Segment"]

Look at the documentation for VectorStyle and especially the part under "Details" to see the full set of options. As a beginner, this is the way to go, and I should probably have used it as well. But as you get more experienced sometimes you don't want to dig in the documentation so you do something quick and dirty like what I did above. It's often useful to be able to, so I'll let the other solution remain in my answer.

My example above was poor, it appears, since it's not a proper slope field. For that part of the question check out Mark McClure's answer.

  • $\begingroup$ +1 for the VectorStyle->"Segment", which I didn't know. Not actually a slope field, however. $\endgroup$ Commented Mar 5, 2014 at 21:48
  • $\begingroup$ @MarkMcClure Thanks for pointing it out, I gave your post a +1 and added a comment about. $\endgroup$
    – C. E.
    Commented Mar 5, 2014 at 22:35
  • $\begingroup$ Well, "slightly off" would be a better description than "poor". :) $\endgroup$ Commented Mar 6, 2014 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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