I have contour plots, such as
plot = ContourPlot[Sqrt[(x - 2)^2 + (y - 2)^2 - 5], {x, -15, 15}, {y, -15, 15}, Contours -> {4}] /. _Polygon -> Sequence[]
I have successfully found the numerical area enclosed using Stokes' theorem, essentially the "x dy" case shown here.
points = Transpose[Cases[Normal@plot, Line[pts_] :> pts, Infinity][[1,
All]]];
area = N[Abs[Rest[First[points]].Last[ListCorrelate[{1, -1}, #1] & /@ points]]]
What I would like to accomplish now is to apply the found area as a Tooltip[]
on the contour plot.
However, this isn't working properly:
Tooltip[ContourPlot[Sqrt[(x - 2)^2 + (y - 2)^2 - 5], {x, -15, 15}, {y, -15, 15}, Contours -> {4}] /. _Polygon -> Sequence[],"example"]
"example"
comes up as a tooltip anywhere on the whole plot area, not just when the cursor is on the contour line. Also, sometimes it doesn't show "example"; it only shows like "ex" and then is cut off by white space.
How can I implement this properly?