

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer

I am trying to make a simple plot of a spherical field falling off with distance from origin:

VectorPlot[{x, y} / EuclideanDistance[{0, 0}, {x, y}]^2, {x, -3, 3}, {y, -3, 3}]

I just get dots. Why do I get this?

enter image description here

share|improve this question
Note that you can replace the denominator of the fraction by the simpler Norm[{x, y}]^2. (But you would probably prefer keeping EuclideanDistance in case the center were not at the origin.) – murray Feb 24 '13 at 23:20
up vote 11 down vote accepted

The problem is that the singularity of the field dominates the scale chosen for the vector arrow size. You have to introduce a cutoff into the function that determines the scale:

With[{maximumModulus = 10}, 
   3}, {y, -3, 3}, 
  VectorScale -> {Automatic, Automatic, 
    If[#5 > maximumModulus, 0, #5] &}]


The magic happens in the VectorScale option where the third entry in the list is a function that filters out values of the field that exceed the maximumModulus cutoff. This is done by setting the excessively large field value(s) to zero so there won't be an arrow for them. This happens right in the center of the plot.

Some alternative ways to visualize vector fields with singularities are discussed here - that was in the context of a complex variable, but it's ultimately the same problem. I repeated this answer here because your question is not about complex fields.

share|improve this answer
+1 So I always like to add an equipotential contour-line plot as the background. – Silvia Feb 24 '13 at 5:29
@Silvia yes, but of course you can only do that if your vector field is conservative (i.e., irrotational). – Jens Feb 24 '13 at 5:31
@Silvia actually, your comment on the background coloring can always work if you make the color plot not for the potential but for the field strength instead. That's what I did here – Jens Feb 24 '13 at 5:38
Well there will always be equi-magnitude level lines :) And in that case I would prefer StreamPlot with color-blending along stream-lines for indicating the magnitude. – Silvia Feb 24 '13 at 5:39
Thank you, Jens. I just encountered this same problem. Diagnosing what the problem may be I tried to get around it with a suitable RegionFunction. To no avail. Apparently that is applied after Mathematica has decided on a scale. – Jyrki Lahtonen Nov 13 '14 at 11:55

An alternative is to use StreamPlot, for example as follows:

    VectorPoints -> 13,
    StreamStyle -> None]

which produces a similar result

enter image description here

Depending on the number of VectorPoints you use, a plot will appear with only points as in the original problem. I presume this also has to do with the vector placement/sampling and the singularity in the vector field being plotted.

Experimenting with the VectorPoints, StreamStyle and other options to the StreamPlot function may lead to more appealing visualizations. Note that in the plot shown here, the 'stream' portion of the StreamPlot has been hidden.

share|improve this answer

Your Answer


