3
$\begingroup$
ParametricPlot[{ Cos[u]^v , u}, {v, 0, 1}, {u, 0, Pi/2 }, Mesh -> {5, 5}]

ParametricPlot[Tootip[{ Cos[u]^v , u}, {v, 0, 1}], {u, 0, Pi/2 }]

How to introduce Tooltip pointers?

( ParametricPlot3D Tooltip may not be available yet? ).

EDIT1:

Updating my question. Please ignore everything above the EDIT1:

ParametricPlot[ { u Cos[v], u Sin[v]}, {u, 1, 2}, {v, 0, Pi/2}, 
 Mesh -> {3, 5}]

It is a two parameter plot. So I like to see either of $ u,v $ parameter lines being pointed at with the value of the set constant only.

To make clear with an example, when I mouse over circles, like to see Tooltips in the above ParametricPlot pointing with SINGLE values {$ 1,1.25,1.5,1.75,2 $} and also when mousing over radial lines SINGLE {$ 0, \pi/12, 2 \pi/12,...5 \pi/12, \pi/2 $ } for the radial lines.

It is a very simple requirement that I believe could cater to a common requirement of a majority of users. I am not looking at high frequency sophisticated dynamic motion picture display. Not even looking at double parameter display at intersection/junction of parameter lines. Just like the way height is displayed for ContourPlots. Here it is required for both parameters, with or without Shading.

Asked this because it is not (yet) a standard feature.

EDIT2:

Based on Michael E2's lines, tried to depict eccentric circles.In the space between parameter lines it may need to be somewhat changed.

{umin, umax, ustep, vmin, vmax, vstep} = {0, 2 Pi, Pi/8, 0.25, 1.25, .25};
ParametricPlot[{Sqrt[2 + v^2] + v Cos[u], v Sin[u]}, {u, umin,  umax}, {v, vmin, vmax}, Mesh -> {Table[{u, Tooltip[Null, u]}, {u, umin, umax, ustep}], 
    Table[{v, Tooltip[Null, v]}, {v, vmin, vmax, vstep}]}] /. {g___, 
   Tooltip[_, label_], l_Line} :> {g, Tooltip[l, label]}
$\endgroup$
  • $\begingroup$ ParametricPlot[Table[Tooltip[{u Cos[v], u Sin[v]}], {v, 0, Pi/2, Pi/20}], {u, .5, 1}, Evaluated -> True]. Is it possible to see pointing for both parameters, u and v? $\endgroup$ – Narasimham Apr 5 '15 at 16:20
  • 1
    $\begingroup$ There are several syntax errors: the correct spelling is Tooltip and only { Cos[u]^v , u} must be wrapped in in, not { Cos[u]^v , u}, {v,0,1}. Then it works (both v10 and v10.1) $\endgroup$ – Szabolcs Apr 5 '15 at 20:26
  • 4
    $\begingroup$ @bbgodfrey (To the OP) It's not a very well phrased question, so it's really hard to see what you are looking for ... such an essential detail should be clearly written in the question itself, not in a comment under one of the answers. This is what I'd do: right clicking the plot and choosing "Get Coordinates" shows the plot coordinates $(x,y)$ when moving the mouse. The CoordinatesToolOptions option controls what is displayed precisely. If the $(u,v) \leftrightarrow (x,y)$ mapping is invertible, you can transform $(x,y)$ back to $(u,v)$ and display them. $\endgroup$ – Szabolcs Apr 5 '15 at 22:32
  • 1
    $\begingroup$ This will show the values everywhere, not only at mesh points. It's still not very clear to me whether you want (1) tooltips only in mesh points or (2) tooltips at any coordinate. Please clarify this in the question. $\endgroup$ – Szabolcs Apr 5 '15 at 22:35
  • 1
    $\begingroup$ @Szabolcs What an instructive comment. I did not know that "Get Coordinates".existed, much less that it and other capabilities could be modified by CoordinatesToolOptions. Many thanks. $\endgroup$ – bbgodfrey Apr 5 '15 at 23:06
4
$\begingroup$

Add a dummy graphic to each mesh line with the appropriate tooltip label and combine them via post-processing:

ParametricPlot[{u Cos[v], u Sin[v]}, {u, 1, 2}, {v, 0, Pi/2},
  Mesh -> {
    Table[{u, Tooltip[Null, u]}, {u, 1, 2, 0.25}],
    Table[{v, Tooltip[Null, v]}, {v, 0, Pi/2, Pi/12}]}
  ] /. {g___, Tooltip[_, label_], l__Line} :> {g, Tooltip[{l}, label]}

Update notice: The pattern was changed from l_Line to l__Line to handle multiple instances of Line in a mesh line, as pointed out by Mr.Wizard in a comment, along with a change in the Tooltip code to handle the sequence l.

$\endgroup$
  • $\begingroup$ Thanks, exactly what I wanted to see... Next I tried on this basis to make only first two lines as variable in code where I put in the parameter start,end, increment values as given in EDIT2:.But still there is a small problem (Null is not Graphics directive..) Null, Disk, these do not work. $\endgroup$ – Narasimham Apr 6 '15 at 17:12
  • 1
    $\begingroup$ @Narasimham There can be more than one Line following the Tooltip in the generated expression. Use this replacement rule instead: {g___, Tooltip[_, label_], l__Line} :> {g, Tooltip[{l}, label]} $\endgroup$ – Mr.Wizard Apr 6 '15 at 17:19
  • $\begingroup$ @Mr.Wizard: It works! ( I was referring to the 2 lines at program start) $\endgroup$ – Narasimham Apr 6 '15 at 17:29
  • $\begingroup$ @Mr.Wizard Thank you. $\endgroup$ – Michael E2 Apr 6 '15 at 22:48
4
$\begingroup$

In Comments above, the OP requested that values be displayed only for mesh points. This can be accomplished as follows, using Annotation.

Show[ParametricPlot[{Cos[u]^v, u}, {v, 0, 1}, {u, 0, Pi/2}, Mesh -> {5, 5}, 
       FrameLabel -> {Cos[u]^v, u}], 
     ListPlot[Quiet@Table[Annotation[{Cos[u]^v, u}, {N[v], N[u]}, "Mouse"], 
       {v, 0, 1, 1/6}, {u, 0, Pi/2, Pi/12}], PlotStyle -> Black], 
     Epilog -> Inset[Dynamic[Style[MouseAnnotation[], Bold, 14]], {.25, 0}]]

The mesh points are generated as a Table (complete with Annotation), plotted with ListPlot, and superimposed using Show on a ParametricPlot of the Mesh. The combined plot is shown below, and Null is replaced by the values {v, u} when the cursor is place on a point.

Mathematica graphics

If, instead, the standard Tooltip appearance is desired, one can use

Show[ParametricPlot[{Cos[u]^v, u}, {v, 0, 1}, {u, 0, Pi/2}, Mesh -> {5, 5}, 
       FrameLabel -> {Cos[u]^v, u}], 
     ListPlot[Quiet@Table[Annotation[{Cos[u]^v, u}, {N[v], N[u]}, "Mouse"], 
       {v, 0, 1, 1/6}, {u, 0, Pi/2, Pi/12}], PlotStyle -> Black], 
     ImagePadding -> {{60, 60}, {40, 10}}, PlotRangeClipping -> False, 
     Epilog -> Inset[Framed[Style[Dynamic[m], "TooltipLabel"], FrameMargins -> 0, 
       ContentPadding -> False], Dynamic[m = MouseAnnotation[]; 
       If[VectorQ[m], {Cos[Last@m]^First@m, Last@m}, {-20, 0}]], {-1.1, -1.1}]]

Addendum

Using the second argument of ToolTip also works well.

Show[ParametricPlot[{Cos[u]^v, u}, {v, 0, 1}, {u, 0, Pi/2}, 
       Mesh -> {5, 5}, FrameLabel -> {Cos[u]^v, u}], 
     ListPlot[Quiet@Table[Tooltip[{Cos[u]^v, u}, {N[v], N[u]}], {v, 0, 1, 1/6}, 
       {u, 0, Pi/2, Pi/12}], PlotStyle -> Black]]

enter image description here

$\endgroup$
3
$\begingroup$

A much more versatile "do-it-yourself" tooltip can be achieved from

ParametricPlot[{Cos[u]^v, u}, {v, 0, 1}, {u, 0, Pi/2}, Mesh -> {5, 5},
  FrameLabel -> {Cos[u]^v, u}, ImagePadding -> {{60, 90}, {40, 10}}, 
  PlotRangeClipping -> False,
  Epilog -> Inset[Framed[Style[Dynamic[{Log[First@mouse]/Log[Cos[Last@mouse]], 
       Last@mouse}], "TooltipLabel"], FrameMargins -> 0, ContentPadding -> False], 
     Dynamic[mouse = MousePosition["Graphics", {.01, .01}]; 
       mouse = {Clip[First@mouse, {0, 1}], Last@mouse}], {-1., -1.}]]

It displays {v, u}.

$\endgroup$
  • $\begingroup$ Does it display (u,v) on parameter curves? $\endgroup$ – Narasimham Apr 5 '15 at 17:32
  • $\begingroup$ @Narasimham It displays {v, u} everywhere in the region, {v, 0, 1}, {u, 0, Pi/2}. $\endgroup$ – bbgodfrey Apr 5 '15 at 17:41
  • $\begingroup$ @Narasimham I corrected a typo (Framed@ in front of the wrong instance of Dynamic) a few minutes ago. So, if you encountered problems, try again with the corrected version. $\endgroup$ – bbgodfrey Apr 5 '15 at 18:07
  • $\begingroup$ It is alright. However, I need display of (u,v) values at default or chosen mesh parameter values only. $\endgroup$ – Narasimham Apr 5 '15 at 18:17
  • $\begingroup$ @Narasimham What do you mean by "default or chosen mesh parameter values "? For instance, do you mean that you wish to display the values of {v, u} at the closest mesh lines? Or, do you mean that you wish to see nothing, unless the pointer is precisely on a mesh line? $\endgroup$ – bbgodfrey Apr 5 '15 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.