I'm trying to plot the electrostatic field generated from a single charge on a plane. Without the $\frac{1}{4\pi\varepsilon_0}$ factor and the value of the charge $q$, as a function of $x, y$ the electric field is $$ \vec{E}(\vec{r})\equiv\vec{E}(x,y) = \frac{\vec{r}}{|\vec{r}|^3}\equiv\begin{cases}\frac{x}{(x^2+y^2)^{\frac{3}{2}}}\\ \frac{y}{(x^2+y^2)^{\frac{3}{2}}}\end{cases} $$ I thought the best way to plot this plane field was the function VectorPlot. Here is the code I entered and the output result

VectorPlot[{x/((x^2 + y^2)^(3/2)), y/((x^2 + y^2)^(3/2))}, {x, -1, 1}, {y, -1, 1}]

enter image description here

I tried to change x_min\x_max and y_min\y_max but I got the same outcome. Why is it plotting only one vector? What am I missing?

I then decided to look at the StreamDensityPlot:

StreamDensityPlot[{x/((x^2 + y^2)^(3/2)), y/((x^2 + y^2)^(3/2))}, {x, -1, 1}, {y, -1, 1}, ColorFunction -> "Rainbow"]

The only result I got was this "purply" plot...

enter image description here

Now I'm a little bit confused on the use of these two plotting function, as on the mathematica documentation online it uses only simple vectorial fields such as $f(x,y) = (x,y)$ and everything looks so cool, but when I approach the basic vectorial field of physics I get only terrible results. Any ideas?

  • $\begingroup$ another possibility is StreamPlot, which is thought to show the direction of the field in each point, regardless of its intensity $\endgroup$
    – glS
    Commented Jul 3, 2017 at 14:27

1 Answer 1


VectorScale can be used to take control of the amplitude.

f[x_, y_] := {x/(x^2 + y^2)^(3/2), y/(x^2 + y^2)^(3/2)}

When close to the origin, set the Norm of the vector (argument #5) to None.

You may want to tweak the value, I used the radius of 0.2 corresponding to

Norm[f[0.2, .2]]


Implementing this in VectorPlot

VectorPlot[f[x, y], {x, -1, 1}, {y, -1, 1}, 
 VectorScale -> {Automatic, Automatic, 
   Function[If[#5 > 12.5, None, #5]] }]

Mathematica graphics


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