ContourLabels has a form {f, g} where f gives an explicit displayed label,
and g gives a Tooltip for each complete contour. But I can't make this form
work and the Help has no explicit example of this form.
Here is an example of what I would like to do:
ContourPlot[Sin[x y] == 1/2, {x, 0, \[Pi]}, {y, 0, \[Pi]},
ContourLabels ->
{Function[{x, y, z}, Text["", {x, y}]],
Function[{x, y, z}, Text["My Label"]]}
]
No tooltips on the contours. I've tried a number of variations but nothing
works. Neither does it work on a regular ContourPlot.
ContourPlot[Sin[x y], {x, 0, \[Pi]}, {y, 0, \[Pi]},
Contours -> 5,
ContourLabels ->
{Function[{x, y, z}, Text["", {x, y}]],
Function[{x, y, z}, Tooltip["My Label"]]}
]
Does anyone know how to do this?
David Park
<http://home.comcast.net/~djmpark> http://home.comcast.net/~djmpark/
ContourLabels -> Automatic for contour labels in tooltips only and
ContourLabels -> True for explicit "printed" contour labels but no tooltips.
But I'm not certain how you get both with plain Mathematica.
With the Presentations package there is a DrawLineLabels routine that will
place explicit contour labels on contour lines (and lines in any 2D plot
that have a function of constant value on the line). So there you could draw
the contour plot with ContourLabels -> Automatic to get tooltips, and then
use DrawLineLabels to explicitly label the contours, or even a selected
subset of contours.
Another quirk of contour labeling is that if you generate a set of contours
by using a Table or Range, say,
Range[-1, 1, 0.2]
you may get a nonzero "zero" value and an ugly label. I suggested to WRI
that since an approximate zero might be a common case they use Chop on label
values, but they thought it is better not to, so you have to do it yourself.
David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/
From: Istv=E1n Zachar [mailto:z...@freemail.hu]
I am interested in the solution as well! It seems so that this
functionality exists only in theory (the documentation) but not in the
field...
Istvan
On Feb 25, 8:51 am, "David Park" <djmp...@comcast.net> wrote:
> I would like to specify custom contour labels in Tooltips for contour
plot.
>
> ContourLabelshas a form {f, g} where f gives an explicit displayed label,
> and g gives a Tooltip for each complete contour. But I can't make this
form
> work and the Help has no explicit example of this form.
>
> Here is an example of what I would like to do:
>
> ContourPlot[Sin[x y] == 1/2, {x, 0, \[Pi]}, {y, 0, \[Pi]},
>
> ContourLabels->
>
> {Function[{x, y, z}, Text["", {x, y}]],
>
> Function[{x, y, z}, Text["My Label"]]}
>
> ]
>
> No tooltips on the contours. I've tried a number of variations but nothing
> works. Neither does it work on a regular ContourPlot.
>
> ContourPlot[Sin[x y], {x, 0, \[Pi]}, {y, 0, \[Pi]},
>
> Contours -> 5,
>
> ContourLabels->
>
> {Function[{x, y, z}, Text["", {x, y}]],
>
> Function[{x, y, z}, Tooltip["My Label"]]}
>
> ]
>
> Does anyone know how to do this?
>
> David Park
>
> djmp...@comcast.net
>
>
<http://home.comcast.net/~djmpark>http://home.comcast.net/~djmpark/
On Feb 25, 8:51 am, "David Park" <djmp...@comcast.net> wrote:
> I would like to specify custom contour labels in Tooltips for contour plot.
>
> ContourLabelshas a form {f, g} where f gives an explicit displayed label,
> and g gives a Tooltip for each complete contour. But I can't make this form
> work and the Help has no explicit example of this form.
>
> Here is an example of what I would like to do:
>
> ContourPlot[Sin[x y] == 1/2, {x, 0, \[Pi]}, {y, 0, \[Pi]},
>
> ContourLabels->
>
> {Function[{x, y, z}, Text["", {x, y}]],
>
> Function[{x, y, z}, Text["My Label"]]}
>
> ]
>
> No tooltips on the contours. I've tried a number of variations but nothing
> works. Neither does it work on a regular ContourPlot.
>
> ContourPlot[Sin[x y], {x, 0, \[Pi]}, {y, 0, \[Pi]},
>
> Contours -> 5,
>
> ContourLabels->
>
> {Function[{x, y, z}, Text["", {x, y}]],
>
> Function[{x, y, z}, Tooltip["My Label"]]}
>
> ]
>
> Does anyone know how to do this?
>
> David Park
>