I have a problem with making contour plots of the form $f(x,y,c)=0$ work well with Mathematica, where c defines the levelset. For example the lemniscate $(x^2 + y^2)^2 - c (x^2 - y^2) =0$. Obviously rewriting this as $\frac{(x^2 + y^2)^2}{(x^2 - y^2)} =c$ is going to cause some problems for anywhere $x^2=y^2$. If I try to plot multiple curves
ContourPlot[Evaluate@Table[(x^2 + y^2)^2 - m (x^2 - y^2) == 0, {m, 0,4}],
{x, -2, 2}, {y, -2, 2}]
this works but I lose the nice shading in between curves and hover over information about the level sets as seen in this example:
ContourPlot[x^2 + y^2, {x, -2, 2}, {y, -2, 2}]
The best I could do is the following:
lemniscates =
Table[
RegionPlot[{(x^2 + y^2)^2 - m (x^2 - y^2) < 0}, {x, -2,
2}, {y, -2, 2}, PerformanceGoal -> "Quality",
BoundaryStyle -> None,
PlotStyle -> {ColorData[{"RedBlueTones", {0, 7}}][m]}], {m, 0,
5}]
Show[Reverse@lemniscates,
Prolog -> {ColorData[{"RedBlueTones", {0, 7}}][7],
Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]}]
but this looks awful compared to the default contour plotting and I still lose the level set information. How do I get my lemniscate plots to look like the ContourPlot
of the circles example?
Thank you!
EDIT: It seems I used a bit too simple an example with the lemniscates to illustrate my problem. Here is another similar function:
ContourPlot[
Evaluate@Table[(x^2 + m y^2)^2 - m (x^2 - y^2) == 0, {m, 0,
4}], {x, -2, 2}, {y, -2, 2}]
But now solving for m gives you two roots so this will not be easy to put in the required form. What can be done?