Quantcast
Channel: Contour Label Problem - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 2

Contour Label Problem

$
0
0

Bug introduced in 10.1 or earlier and persisting through 11.0.1 or later


Consider:

f[x_, y_] = x^2 + y^2;g[x_, y_] = x^4 + y^4;critPts =  Solve[{Grad[f[x, y], {x, y}] == \[Lambda] Grad[g[x, y], {x, y}],    g[x, y] == 1}, {x, y, \[Lambda]} \[Element] Reals]

Then:

ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, PlotLegends -> Automatic, MeshFunctions -> Function[{x, y}, g[x, y]], Mesh -> {{1}}, MeshStyle -> {Thick, Yellow}, Epilog -> {   Red, PointSize[Large], Point[{x, y}] /. critPts   }]

Which produces this image:

enter image description here

Now, we add specific contours.

ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, Contours -> {1, Sqrt[2]}, PlotLegends -> Automatic, MeshFunctions -> Function[{x, y}, g[x, y]], Mesh -> {{1}}, MeshStyle -> {Thick, Yellow}, Epilog -> {   Red, PointSize[Large], Point[{x, y}] /. critPts   }]

Which produces this image.

enter image description here

Now, if you hover your mouse over the two contours, tooltip labels of 1 and $\sqrt2$ appear.

Now consider this:

ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, Contours -> {1, Sqrt[2], 3}, PlotLegends -> Automatic, MeshFunctions -> Function[{x, y}, g[x, y]], Mesh -> {{1}}, MeshStyle -> {Thick, Yellow}, Epilog -> {   Red, PointSize[Large], Point[{x, y}] /. critPts   }]

Which produces this image.

enter image description here

Now, hover your mouse over each contour and you will see the incorrect tooltip labels pop up.

Is this a bug?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images