1
$\begingroup$

After searching, I learned how to make "GridLines" in DensityPlot by Mesh/MeshFunctions.

Here I'd like to draw an addition Mesh line at Q=6^(0.25) via Mesh/MeshFunctions or other ways and highlight it with a different style.

Please have a look at my code below:

Manipulate[
 DensityPlot[EsEtSin, {defocus, -1, 4}, {Q, 0, 3},
  FrameLabel -> {"D", "Q"}, PlotPoints -> 30,

  Mesh -> {{Sqrt[(8 n + 3)/2]}}, MeshFunctions -> {#1 &}, 
  MeshStyle -> {Thick, Cyan}, 

  Epilog -> 
   Inset[Framed["Q=\!\(\*SuperscriptBox[\(6\), \(1/4\)]\)", 
     RoundingRadius -> 5, Background -> White], {0.5, 1.8}]],

 {{n, 0, "Pass Band No."}, 0, 3, 1, ControlType -> Setter},

 Initialization :> (q0 = .1; delta = .1;
   EsEt = E^(-(\[Pi]^2/2) (delta^2 Q^4 + 2 q0^2 (Q^3 - defocus Q)^2));
    EsEtSin = EsEt Sin[\[Pi] (1/2 Q^4 - defocus Q^2)])
 ]

Any help is highly appreciated.

$\endgroup$
1
  • $\begingroup$ Mesh -> {{Sqrt[(8 n + 3)/ 2]}, {6^.25}}, MeshFunctions -> {#1 &, #2 &}, MeshStyle -> \ {{Thick, Cyan}, {Thick, Red}} $\endgroup$ Feb 17, 2016 at 11:54

1 Answer 1

2
$\begingroup$

I think this is a well-framed question that deserves a proper answer, so I'm putting eqwene sedai's comment on record.

DynamicModule[{defocus},
  Manipulate[
    DensityPlot[EsEtSin, {defocus, -1, 4}, {Q, 0, 3}, 
      FrameLabel -> {"D", "Q"},
      PlotPoints -> 30,
      Mesh -> {{Sqrt[(8 n + 3)/2]}, {6^.25}},
      MeshFunctions -> {#1 &, #2 &}, 
      MeshStyle -> {{Thick, Cyan}, {Thick, Red}},
      Epilog ->
        Inset[
          Framed["\!\(\*SuperscriptBox[\(6\), \(1/4\)]\)", 
            RoundingRadius -> 5, Background -> White], 
          {0., 1.75}]],
    {{n, 0, "Pass Band No."}, Range[0, 3]},
    Initialization :> (
      q0 = .1;
      delta = .1;
      EsEt = E^(-(π^2/2) (delta^2 Q^4 + 2 q0^2 (Q^3 - defocus Q)^2));
      EsEtSin = EsEt Sin[π (1/2 Q^4 - defocus Q^2)])]]

plot

$\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.