1
$\begingroup$

I am trying to combine a 3D plot and a 2D density plot such that the 2D density plot appears as a shadow of the 3D plot but when I use the 'slicedensityplot' command, the plot appears with holes in it. It is not even being fixed by changing plot range options or changing other values.

If I change the values of 'x' and 'y' to {-2,2}, then there are no holes but I don't want my domain to be in a small range.

Moreover, if the domain was the problem, then the simple 3D plot and 2D density plot should also have holes in them but there is no problem in those plots.

Can anyone guide me on why there are holes and how to fix them?

Sorry for the long code:)

 eqn= -(1/1024)1816713371 E^(-2 (Abs[1/Sqrt[2] - x - I y]^2 + 
 5 Re[Log[Sqrt[2] - 4 x - 4 I y]])) (122880 Abs[
  1/32 - (5 x)/(8 Sqrt[2]) + (5 x^2)/2 - 5 Sqrt[2] x^3 + 10 x^4 - 
   4 Sqrt[2] x^5 - 
   5/16 I (Sqrt[2] - 16 x + 48 Sqrt[2] x^2 - 128 x^3 + 
      64 Sqrt[2] x^4) y + 
   5/2 (-1 + 6 Sqrt[2] x - 24 x^2 + 16 Sqrt[2] x^3) y^2 + 
   5 I (Sqrt[2] - 8 x + 8 Sqrt[2] x^2) y^3 + (10 - 
      20 Sqrt[2] x) y^4 - 4 I Sqrt[2] y^5]^2 - 
150 Abs[(1/(
  I - 2 I Sqrt[2] x + 
   2 Sqrt[2]
     y))(Sqrt[2] - 4 x - 
     4 I y) (-I (-9 + 88 Sqrt[2] x - 680 x^2 + 1280 Sqrt[2] x^3 - 
        2240 x^4 + 512 Sqrt[2] x^5 + 512 x^6) + 
     8 (11 Sqrt[2] - 170 x + 480 Sqrt[2] x^2 - 1120 x^3 + 
        320 Sqrt[2] x^4 + 384 x^5) y + 
     40 I (-17 + 96 Sqrt[2] x - 336 x^2 + 128 Sqrt[2] x^3 + 
        192 x^4) y^2 - 
     1280 (Sqrt[2] - 7 x + 4 Sqrt[2] x^2 + 8 x^3) y^3 - 
     320 I (-7 + 8 Sqrt[2] x + 24 x^2) y^4 + 
     512 (Sqrt[2] + 6 x) y^5 + 512 I y^6)]^2 + 
75/2 Abs[(
  1/((I - 2 I Sqrt[2] x + 
    2 Sqrt[2] y)^2))(Sqrt[2] - 4 x - 4 I y)^2 (-61 + 
     574 Sqrt[2] x - 4168 x^2 + 6960 Sqrt[2] x^3 - 8640 x^4 - 
     2432 Sqrt[2] x^5 + 6656 x^6 + 1024 Sqrt[2] x^7 + 
     2 I (287 Sqrt[2] - 4168 x + 10440 Sqrt[2] x^2 - 17280 x^3 - 
        6080 Sqrt[2] x^4 + 19968 x^5 + 3584 Sqrt[2] x^6) y - 
     8 (-521 + 2610 Sqrt[2] x - 6480 x^2 - 3040 Sqrt[2] x^3 + 
        12480 x^4 + 2688 Sqrt[2] x^5) y^2 - 
     80 I (87 Sqrt[2] - 432 x - 304 Sqrt[2] x^2 + 1664 x^3 + 
        448 Sqrt[2] x^4) y^3 + 
     320 (-27 - 38 Sqrt[2] x + 312 x^2 + 112 Sqrt[2] x^3) y^4 + 
     128 I (-19 Sqrt[2] + 312 x + 168 Sqrt[2] x^2) y^5 - 
     512 (13 + 14 Sqrt[2] x) y^6 - 1024 I Sqrt[2] y^7)]^2 - 
25/8 Abs[(
  1/((I - 2 I Sqrt[2] x + 
    2 Sqrt[2] y)^3))(Sqrt[2] - 4 x - 
     4 I y)^3 (I (-269 + 2324 Sqrt[2] x - 14416 x^2 + 
        15904 Sqrt[2] x^3 + 14080 x^4 - 49408 Sqrt[2] x^5 + 
        29696 x^6 + 22528 Sqrt[2] x^7 + 4096 x^8) - 
     4 (581 Sqrt[2] - 7208 x + 11928 Sqrt[2] x^2 + 14080 x^3 - 
        61760 Sqrt[2] x^4 + 44544 x^5 + 39424 Sqrt[2] x^6 + 
        8192 x^7) y - 
     16 I (-901 + 2982 Sqrt[2] x + 5280 x^2 - 30880 Sqrt[2] x^3 + 
        27840 x^4 + 29568 Sqrt[2] x^5 + 7168 x^6) y^2 + 
     32 (497 Sqrt[2] + 1760 x - 15440 Sqrt[2] x^2 + 18560 x^3 + 
        24640 Sqrt[2] x^4 + 7168 x^5) y^3 + 
     1280 I (11 - 193 Sqrt[2] x + 348 x^2 + 616 Sqrt[2] x^3 + 
        224 x^4) y^4 - 
     256 (-193 Sqrt[2] + 696 x + 1848 Sqrt[2] x^2 + 
        896 x^3) y^5 - 
     1024 I (29 + 154 Sqrt[2] x + 112 x^2) y^6 + 
     2048 (11 Sqrt[2] + 16 x) y^7 + 4096 I y^8)]^2 + 
25/256 Abs[(
  1/((I - 2 I Sqrt[2] x + 
    2 Sqrt[2] y)^4))(Sqrt[2] - 4 x - 4 I y)^4 (441 - 
     2258 Sqrt[2] x - 4832 x^2 + 72896 Sqrt[2] x^3 - 324736 x^4 + 
     209152 Sqrt[2] x^5 + 206848 x^6 - 200704 Sqrt[2] x^7 - 
     126976 x^8 - 8192 Sqrt[2] x^9 - 
     2 I (1129 Sqrt[2] + 4832 x - 109344 Sqrt[2] x^2 + 
        649472 x^3 - 522880 Sqrt[2] x^4 - 620544 x^5 + 
        702464 Sqrt[2] x^6 + 507904 x^7 + 36864 Sqrt[2] x^8) y + 
     32 (151 - 6834 Sqrt[2] x + 60888 x^2 - 65360 Sqrt[2] x^3 - 
        96960 x^4 + 131712 Sqrt[2] x^5 + 111104 x^6 + 
        9216 Sqrt[2] x^7) y^2 + 
     64 I (-1139 Sqrt[2] + 20296 x - 32680 Sqrt[2] x^2 - 
        64640 x^3 + 109760 Sqrt[2] x^4 + 111104 x^5 + 
        10752 Sqrt[2] x^6) y^3 - 
     128 (2537 - 8170 Sqrt[2] x - 24240 x^2 + 54880 Sqrt[2] x^3 + 
        69440 x^4 + 8064 Sqrt[2] x^5) y^4 - 
     256 I (-817 Sqrt[2] - 4848 x + 16464 Sqrt[2] x^2 + 
        27776 x^3 + 4032 Sqrt[2] x^4) y^5 + 
     2048 (-101 + 686 Sqrt[2] x + 1736 x^2 + 
        336 Sqrt[2] x^3) y^6 + 
     4096 I (49 Sqrt[2] + 248 x + 72 Sqrt[2] x^2) y^7 - 
     4096 (31 + 18 Sqrt[2] x) y^8 - 8192 I Sqrt[2] y^9)]^2 - (1/
1024)(Abs[(
 1/((I - 2 I Sqrt[2] x + 
   2 Sqrt[2] y)^5))(Sqrt[2] - 4 x - 
    4 I y)^5 (-I (1711 - 21520 Sqrt[2] x + 203560 x^2 - 
       421120 Sqrt[2] x^3 + 429440 x^4 + 1060864 Sqrt[2] x^5 - 
       2862080 x^6 + 81920 Sqrt[2] x^7 + 1617920 x^8 + 
       327680 Sqrt[2] x^9 + 32768 x^10) + 
    80 (-269 Sqrt[2] + 5089 x - 15792 Sqrt[2] x^2 + 21472 x^3 + 
       66304 Sqrt[2] x^4 - 214656 x^5 + 7168 Sqrt[2] x^6 + 
       161792 x^7 + 36864 Sqrt[2] x^8 + 4096 x^9) y + 
    40 I (5089 - 31584 Sqrt[2] x + 64416 x^2 + 
       265216 Sqrt[2] x^3 - 1073280 x^4 + 43008 Sqrt[2] x^5 + 
       1132544 x^6 + 294912 Sqrt[2] x^7 + 36864 x^8) y^2 - 
    1280 (-329 Sqrt[2] + 1342 x + 8288 Sqrt[2] x^2 - 44720 x^3 + 
       2240 Sqrt[2] x^4 + 70784 x^5 + 21504 Sqrt[2] x^6 + 
       3072 x^7) y^3 - 
    640 I (671 + 8288 Sqrt[2] x - 67080 x^2 + 4480 Sqrt[2] x^3 + 
       176960 x^4 + 64512 Sqrt[2] x^5 + 10752 x^6) y^4 + 
    2048 (518 Sqrt[2] - 8385 x + 840 Sqrt[2] x^2 + 44240 x^3 + 
       20160 Sqrt[2] x^4 + 4032 x^5) y^5 + 
    5120 I (-559 + 112 Sqrt[2] x + 8848 x^2 + 5376 Sqrt[2] x^3 + 
       1344 x^4) y^6 - 
    81920 (Sqrt[2] + 158 x + 144 Sqrt[2] x^2 + 48 x^3) y^7 - 
    20480 I (79 + 144 Sqrt[2] x + 72 x^2) y^8 + 
    327680 (Sqrt[2] + x) y^9 + 32768 I y^10)]^2));

p1 = Plot3D[eqn, {x, -5, 5}, {y, -5, 5}, PlotRange -> All, 
  ImageSize -> Medium, ColorFunction -> "CMYKColors", Mesh -> None, 
  Exclusions -> None];

p2 = DensityPlot[eqn, {x, -5, 5}, {y, -5, 5}, PlotRange -> All, 
  ColorFunction -> "CMYKColors", ImageSize -> Medium, 
  PlotLegends -> Automatic, Exclusions -> None];

min = N[MinValue[eqn, {x, y}]];

p3 = SliceDensityPlot3D[
  eqn, {"ZStackedPlanes", {min - .1}}, {x, -5, 5}, {y, -5, 5}, {z, 
   min - .1, min - .5}, PlotRange -> Automatic, 
  ColorFunction -> "CMYKColors", PlotLegends -> Automatic, 
  ImageSize -> Medium, Exclusions -> None];

Show[p1,p3]

enter image description here

$\endgroup$
7
  • $\begingroup$ Something similar to 14863, 267291, 154370 or 159453? $\endgroup$
    – rhermans
    Commented May 18, 2022 at 9:14
  • $\begingroup$ Yes its similar even I learnt the above code from 267291 but there is an error in my plot which I can't resolve that's why I asked this question:) $\endgroup$
    – Anaya
    Commented May 18, 2022 at 9:23
  • $\begingroup$ min = N[MinValue[eqn, {x, y}]] evaluates to error MinValue::objc, that is the function return a complex and can't be minimized. I can't reproduce the holes in p1 or p2. $\endgroup$
    – rhermans
    Commented May 18, 2022 at 9:57
  • $\begingroup$ When I do this, it gives this error but also gives the value -3.47637* 10^(11) so I used this as minimum value $\endgroup$
    – Anaya
    Commented May 18, 2022 at 10:03
  • 1
    $\begingroup$ It is always better to share a minimum working example, removing all that is not relevant to your question. You are making it harder for us to look into your problem. Increasing the range in {z, min - 50, min + 50} remove the holes, that come from the surface been outside the defined range. $\endgroup$
    – rhermans
    Commented May 18, 2022 at 10:16

1 Answer 1

1
$\begingroup$

Increasing the range in {z, min - 1, min + 1} removes the holes, that come from the surface existing outside the defined range.

min =-3 10^12
(* -3000000000000 *)

p3 = SliceDensityPlot3D[
  eqn
  , {"ZStackedPlanes", {min - .1}}
  , {x, -5, 5}
  , {y, -5, 5}
  , {z,   min - 1, min + 1}
  , PlotRange -> Automatic
  , ColorFunction -> "CMYKColors"
  , PlotLegends -> Automatic
  , ImageSize -> Medium
  , Exclusions -> None]

enter image description here

$\endgroup$

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