1
$\begingroup$

I want to display a coordinate grid in parabolic coordinates:

ParametricPlot[{-parabolic[r, phi], parabolic[r, phi]}, {r,0,1}, {phi,-1, 1},
  PlotStyle -> {Gray, Gray}, 
  BoundaryStyle -> Dashed, Mesh -> 9, Frame -> False, Ticks -> None]

where

parabolic[r_,phi_] := {1/2 (r^2 - phi^2), phi r};

Is there a relatively simply way to include labels for a selection of coordinate curves within the plot (essentially a 'non-dynamic' Tooltip)?

$\endgroup$
4
  • $\begingroup$ Please post parabolic[] here. $\endgroup$
    – cvgmt
    Commented May 3, 2021 at 5:01
  • $\begingroup$ Apologies for the oversight! Corrected in the original post $\endgroup$
    – gilonik
    Commented May 3, 2021 at 13:27
  • $\begingroup$ by the way, what sort of labels do you want (e.g. parabolic tickmarks?), how many do you want, and how do you want them distributed (on top of the region, in Callouts, etc.)? $\endgroup$
    – thorimur
    Commented May 3, 2021 at 19:22
  • $\begingroup$ Not call outs with lines; it'll make the diagram too noisy. Just enough labeling (possibly w/ ticks?) to show how the independent variables r and phi change (+/-) in the plane $\endgroup$
    – gilonik
    Commented May 3, 2021 at 23:16

1 Answer 1

2
$\begingroup$

To see Tooltips it is easier to use ContourPlot

Clear["Global`*"]

parabolic[r_, phi_] := {1/2 (r^2 - phi^2), phi r};

sol[1] = Solve[{x, y} == parabolic[r, phi], {r, phi}, Reals];

sol[2] = Solve[{x, y} == -parabolic[r, phi], {r, phi}, Reals];

{cpr1, cpr2} = ContourPlot[r /. sol[#],
      {x, -0.5, 0.5}, {y, -1, 1},
      Contours -> Range[0, 1, 0.2],
      ContourStyle -> Directive[{Red, Blue}[[#]], AbsoluteThickness[1.5]],
      ContourShading -> None,
      ContourLabels -> All,
      PlotPoints -> 50,
      AspectRatio -> 2,
      ImageSize -> Medium ,
      RegionFunction -> Function[{x, y, r},
        Evaluate[(And @@ Thread[-1 <= (phi /. sol[#]) <= 1])]] ] /. 
     {Tooltip[expr_, tooltip_] :>
       Tooltip[expr, StringForm["r``=``", #,
         NumberForm[tooltip, 1]]]} & /@ {1, 2};

Show[cpr1, cpr2, PlotRange -> {{-0.55, 0.55}, {-1, 1}}]

enter image description here

{cpp1, cpp2} = ContourPlot[phi /. sol[#],
      {x, -0.5, 0.5}, {y, -1, 1},
      Contours -> Range[0, 1, 0.2],
      ContourStyle -> Directive[{Red, Blue}[[#]], AbsoluteThickness[1.5]],
      ContourShading -> None,
      ContourLabels -> All,
      PlotPoints -> 50,
      AspectRatio -> 2 ,
      ImageSize -> Medium ,
      RegionFunction -> Function[{x, y, r},
        Evaluate[(And @@ Thread[-1 <= (r /. sol[#]) <= 1])]] ] /. 
     {Tooltip[expr_, tooltip_] :>
       Tooltip[expr, StringForm["phi``=``", #,
         NumberForm[tooltip, 1]]]} & /@ {1, 2};

Show[cpp1, cpp2, PlotRange -> {{-0.55, 0.55}, {-1, 1}}]

enter image description here

Row[{
  Show[cpr1, cpp1, PlotRange -> {{-0.55, 0.55}, {-1, 1}}],
  Show[cpr2, cpp2, PlotRange -> {{-0.55, 0.55}, {-1, 1}}]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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