0
$\begingroup$

I have the following ListDensityPlot :

ListDensityPlot[
 Table[Y^2 + Z^2, {Y, -1, 1, Pi/300}, {Z, -1, 1, Pi/300}], 
 ColorFunction -> "SunsetColors", 
 RegionFunction -> Function[{x, y, z}, (0.74)^2 < x^2 + y^2 < (0.785)^2 ], 
 PlotLegends -> Automatic, DataRange -> {{-1, 1}, {-1, 1}}]

enter image description here

Here I have limited the ListDensityPlot over a crown. My problem is that I want to limit the ListDensityPlot following this multiple Plot bellow :

Plot[{1/2 (ArcCos[1 - Cos[2 kx]]), -1/2 (ArcCos[1 - Cos[2 kx]])}, 
 {kx,-1, 1}, AxesLabel -> {"kx", "ky"}]

enter image description here

Is there a way to do this with RegionFunction like I did for the crown, or with an other way ?

@shrx Why the thickness is not the same at right and top with your code ? Is there a way to rectify that ?

Thank you

Geoffroy

$\endgroup$
1
$\begingroup$

Maybe something like this:

ListDensityPlot[
  Table[Y^2 + Z^2, {Y, -1, 1, Pi/300}, {Z, -1, 1, Pi/300}], 
  ColorFunction -> "SunsetColors", 
  RegionFunction -> 
   Function[{x, y, z}, 
    TrueQ[0 <= y + 1/2 (ArcCos[1 - Cos[2 x]]) <= 0.785 - .74] \[Or] 
     TrueQ[.74 - 0.785 <= y - 1/2 (ArcCos[1 - Cos[2 x]]) <= 0]], 
  PlotLegends -> Automatic, DataRange -> {{-1, 1}, {-1, 1}}] // Quiet

That Quiet is there because otherwise mathematica complains about the comparison of complex numbers. The output looks like this:

custom region function

$\endgroup$
  • $\begingroup$ Thanks you for your help ! My problem is solved now :) $\endgroup$ – Geoff Hudson Mar 20 '15 at 9:03

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.