# How to plot a vector field on a circle?

I have two vector fields (electric fields) for inside and outside an sphere of radius $R$ (lets suppose $R=1$), expressed as:

Pins[r_, θ_, ϕ_] := -3*Eo/(2 + et)*r*Cos[θ]
Pout[r_, θ_, ϕ_] := -Eo*r*Cos[θ] - Eo*R^3/r^2*((1 - et)/(2 + et))*Cos[θ]
Eins = -Grad[Pins[r, θ, ϕ], {r, θ, ϕ}, "Spherical"]
Eout = -Grad[Pout[r, θ, ϕ], {r, θ, ϕ}, "Spherical"


or

$$E_{outside}=E_{o}\widehat{e_{z}}-\dfrac{E_{o}R^{3}}{r^{3}}(\dfrac{\epsilon-1}{2+\epsilon})(2cos\theta\widehat{e_{r}}+sen\theta\widehat{e_{\theta}})$$ $$E_{inside}=\dfrac{3E_{o}}{2+\epsilon}\widehat{e_{z}}$$

My question is, how can I change the domain of the vector plot (in 2D) in order to display the vector field only for inside or outside the circle using the associated electric field? Or is there any other suggestions for this task to be done? I just want to plot both vector fields.

Pins[r_, θ_, ϕ_] := -3*Eo/(2 + et)*r*Cos[θ]
Pout[r_, θ_, ϕ_] := -Eo*r*Cos[θ] - Eo*R^3/r^2*((1 - et)/(2 + et))*Cos[θ]


and then

Eins = -Grad[Pins[r, θ, ϕ], {r, θ, ϕ}, "Spherical"]

(* {(3 Eo Cos[θ])/(2 + et), -((3 Eo Sin[θ])/(2 + et)), 0} *)

Eout = -Grad[Pout[r, θ, ϕ], {r, θ, ϕ},"Spherical"]

(* {Eo Cos[θ] - (2 Eo (1 - et) R^3 Cos[θ])/((2 + et) r^3),
-((Eo r Sin[θ] + (Eo (1 - et) R^3 Sin[θ])/((2 + et) r^2))/r), 0} *)


Plot the inside field first.

We make a substitution to get it into Cartesian coordinates. Also one has to supply it with numerical values for Eo and et, I will use 5 and 2.

The 2D vector field for inside a circle is

{(3 Eo Cos[θ])/(
2 + et), -((3 Eo Sin[θ])/(2 + et))} /. {
Cos[θ] -> x/Sqrt[x^2 + y^2],
Sin[θ] -> y/Sqrt[x^2 + y^2],
Eo -> 5,  et -> 2}

(* {(15 x)/(4 Sqrt[x^2 + y^2]), -((15 y)/(4 Sqrt[x^2 + y^2]))} *)


One can use a region to limit the plot to inside a unit circle

inside=VectorPlot[{(15 x)/(4 Sqrt[x^2 + y^2]), -((15 y)/(4 Sqrt[x^2 + y^2]))},
{x, y} ∈ ImplicitRegion[1 > x^2 + y^2, {x, y}]]


Follow a similar workflow for the field outside the circle. Here I replace R and r with Sqrt[x^2+y^2]. I am not sure that is what you want but you should be able to figure out how to correct it if my guess is wrong.

{Eo Cos[θ] - (2 Eo (1 - et) R^3 Cos[θ])/((2 + et) r^3),
-((Eo r Sin[θ] + (Eo (1 - et) R^3 Sin[θ])/((2 + et) r^2))/r)} /.
{
Cos[θ] -> x/Sqrt[x^2 + y^2],
Sin[θ] -> y/Sqrt[x^2 + y^2],
Eo -> 5, et -> 2,
R -> Sqrt[x^2 + y^2],
r -> Sqrt[x^2 + y^2]}

(* {(15 x)/(2 Sqrt[x^2 + y^2]), -((15 y)/(4 Sqrt[x^2 + y^2]))} *)


and then

outside=VectorPlot[{(15 x)/(2 Sqrt[x^2 + y^2]), -((15 y)/(4 Sqrt[x^2 + y^2]))},
{x, y} ∈ ImplicitRegion[1 < x^2 + y^2, {x, y}]]


As an option one can shade the active region using RegionPlot.

Show[
RegionPlot[x^2 + y^2 < 1,
{x, -1.2, 1.2},
{y, -1.2, 1.2},
PlotStyle -> {Opacity[0.2], Cyan},
BoundaryStyle -> None
],
inside
]


Show[
RegionPlot[x^2 + y^2 > 1,
{x, -2.4, 2.4},
{y, -2.4, 2.4},
PlotStyle -> {Opacity[0.2], Cyan},
BoundaryStyle -> None
],
outside
]