I have a function defined as:

$\rho_{m}\left(\epsilon,m\right)=\left[-2\epsilon r\pm\left(4\epsilon^{2}r^{2}+m\lambda r^{3}\right)^{\frac{1}{2}}\right]^{\frac{1}{2}}$

I want to plot it for some $m\in \mathbb{Z}$, so I wrote this code:

p1=Show[Plot[\[Rho]1[\[Epsilon]*10^-3,#]*10^3, {\[Epsilon],-0.5,0.5}, PlotRange -> {{-0.5,0.5},{0, 5}},AxesOrigin->{-0.5,0},PlotTheme->"Monochrome"] & /@ M];
p2=Show[Plot[\[Rho]2[\[Epsilon]*10^-3,#]*10^3, {\[Epsilon],-0.5,0.5}, PlotRange -> {{-0.5,0.5},{0, 5}},AxesOrigin->{-0.5,0},PlotTheme->"Monochrome"] & /@ M];

Which outputs:

enter image description here

However, there are some tiny gaps where the two functiosn meet, but I was expecting them to be continuous. How can I fix that?

  • $\begingroup$ Adding the option PlotPoints->1000 to both your Plots will make those gaps much less visible. $\endgroup$
    – Bill
    Apr 26, 2019 at 19:19
  • $\begingroup$ I think that the problem may be that the functions become imaginary at $\epsilon = 0$. Plot doesn't plot anything at all when the value is imaginary. When it happens precisely at the point where they're supposed to meet I guess it becomes a numerical issue, hence why PlotPoints may help. $\endgroup$
    – C. E.
    Apr 26, 2019 at 19:38

1 Answer 1


If you turn the equation around and plot $\epsilon$ as a function of $\rho$, then there are no gaps and no branches:

λ = 685*10^-9;
r = 25*10^-3;
ParametricPlot[Table[10^3 {(m r^3 λ - ρ^4)/(4 r ρ^2), ρ}, {m, -5, 5}],
  {ρ, 0, 5*10^-3}, AspectRatio -> 1/GoldenRatio]

enter image description here


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.