# Contourplot gives inaccurate ellipses

I'm trying to draw a family of ellipses with pre-defined foci as follows:

    foci = {{-3, 25}, {2, 20}};
ContourPlot[Tr[EuclideanDistance[#, {x, y}] & /@ foci], {x, -5, 5}, {y, 10, 30},
Epilog -> {Black, PointSize[Large], Point@foci}]


which produces the following output:

The contours do seem to be ellipses, but not ones with the specified foci, and they also look like their axes are rotated at varying angles. How can I get ellipses with the correct foci?

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. Commented Mar 4, 2015 at 23:11

Looks fine to me, once you get your aspect ratio proper.

foci = {{-3, 25}, {2, 20}};
ContourPlot[
Total[EuclideanDistance[#, {x, y}] & /@ foci],
{x, -5, 5}, {y, 10, 30},
AspectRatio -> 2,
Epilog -> {Black, PointSize[Large], Point@foci}]


or your horizontal and vertical ranges equal:

foci = {{-3, 25}, {2, 20}};
mycontplot = ContourPlot[
Total[EuclideanDistance[#, {x, y}] & /@ foci],
{x, -10, 10}, {y, 10, 30},
Epilog -> {Black, PointSize[Large], Point@foci}]


• +1, AspectRatio->Automatic will work in general.
– Kuba
Commented Mar 4, 2015 at 23:20