2
$\begingroup$

In the image below, I have indicated parts of the box feature, which I would like gone. Is it possible to remove some of the box in a Plot3D, and if so, how? My code for generating the image is shown below, and I would like to know how to change it to have the desired effect.

 expr = ((1 - p1) p1 (-128 ((1 - p1) p1)^(3/2) (-1 + p2)^2 p2^2 + (384 (-1 + p1)^3 p1^3)/Sqrt[1/(p2 - p2^2)] + 128 Sqrt[(1 - p1) p1] (-1 + p2)^3 p2^3 (-3 + 2 Sqrt[((-1 + p2) p2)/((-1 + p1) p1)]) + 128 Sqrt[1/(p1 - p1^2)] (3 (-1 + p1) p1 (-1 + p2)^3 p2^3 - (-1 + p2)^4 p2^4 + (2 ((1 - p2) p2)^(7/2))/Sqrt[1/(p1 - p1^2)] + ((-1 + p2)^4 p2^4)/(((-1 + p2) p2)/((-1 + p1) p1))^(3/2) + 3 (-1 + p1)^4 p1^4 Sqrt[((-1 + p2) p2)/((-1 + p1) p1)] - 6 (-1 + p1)^4 p1^4 (((-1 + p2) p2)/((-1 + p1) p1))^(3/2)) + 4 (1 - p1) p1 (-128 ((1 - p2) p2)^(5/2) - 96/(1/(p2 - p2^2))^(5/2)) + 256 (-1 + p1)^2 p1^2 (((1 - p2) p2)^(3/2) + 3/(1/(p2 - p2^2))^(3/2))))/(64 (p1 - p2)^2 ((1 - p2) p2)^(3/2) (-1 + p1 + p2)^2) // Simplify;

Plot3D[If[p1 == p2, -(-1 + p1) p1, expr], {p1, 0.5, 0.999}, {p2, 0.5, 0.999}, Exclusions -> None, PlotLegends -> Automatic, AxesLabel -> {Subscript[p, 1], Subscript[p, 2]}, PlotPoints -> 100, ColorFunction -> (If[#3 < 0, Lighter[RGBColor[0.368417, 0.506779, 0.709798], 0.00], White] &), ColorFunctionScaling -> False, ViewPoint -> {1.8797, -2.3832, 1.4956}, ImageSize -> {400, Automatic}]

enter image description here

$\endgroup$
  • 2
    $\begingroup$ See this link $\endgroup$ – Hubble07 Jan 12 at 9:13
  • 1
    $\begingroup$ Please post minimal working examples with your questions. Your question is about the Frame / Box and to get an answer does not require the use of a complicated function and multiple options to the Plot3D $\endgroup$ – Bob Hanlon Jan 12 at 18:46
3
$\begingroup$

Using Scaled coordinates and AxisEdge, we can easily position all the necessary elements:

Graphics3D[
 {
  Line[
   Scaled /@ {
     {0, 0, 0},
     {0, 1, 0},
     {1, 1, 0}
     }
   ]
  },
 Axes -> True,
 AxesStyle -> Black,
 AxesEdge -> {{-1, -1}, {1, -1}, {-1, -1}},
 Boxed -> False
 ]

enter image description here

Using AxesEdge -> …, we force the axes to be drawn on the proper sides of the plot. The missing two lines on the bottom are drawn using Line, with coordinates specified using Scaled.

I've omitted the plot itself to make it easier to see the relevant parts. You can simply combine this with the plot using Show:

Show[
  Plot3D[
    If[p1 == p2, -(-1 + p1) p1, expr], 
    {p1, 0.5, 0.999},
    {p2, 0.5, 0.999},
    Exclusions -> None,
    PlotLegends -> Automatic,
    AxesLabel -> {Style[Subscript[p, 1], Black, 18], Style[Subscript[p, 2], Black, 18], Style["expr", Black, 18]},
    PlotPoints -> 100,
    ColorFunction -> (If[#3 < 0, Lighter[RGBColor[0.368417, 0.506779, 0.709798], 0.00], White] &),
    ColorFunctionScaling -> False,
    ImageSize -> {400, Automatic},
    Axes -> True,
    AxesStyle -> Black,
    AxesEdge -> {{-1, -1}, {1, -1}, {-1, -1}},
    Boxed -> False
  ],
  Graphics3D[
    {
     Line[
      Scaled /@ {
        {0, 0, 0},
        {0, 1, 0},
        {1, 1, 0}
        }
      ]
     }
   ]
 ]

enter image description here

$\endgroup$
0
$\begingroup$

This solution is based on trial and error

Show[Plot3D[
  If[p1 == p2, -(-1 + p1) p1, expr], {p1, 0.5, 0.999}, {p2, 0.5, 
   0.999}, Exclusions -> None, PlotLegends -> Automatic, 
  AxesLabel -> {Style[Subscript[p, 1], Black, 18], 
    Style[Subscript[p, 2], Black, 18], Style["expr", Black, 18]}, 
  PlotPoints -> 100, 
  ColorFunction -> (If[#3 < 0, 
      Lighter[RGBColor[0.368417, 0.506779, 0.709798], 0.00], 
      White] &), ColorFunctionScaling -> False, 
  ViewPoint -> {1.8797, -2.3832, 1.4956}, 
  ImageSize -> {400, Automatic}, Boxed -> False, 
  AxesStyle -> Directive[Black, Thick, 12]], 
 Graphics3D[{Thick, Black, 
   Line[{{0.49, 0.49, -0.13}, {0.49, 1.008, -0.13}, {1.008, 
      1.008, -0.13}}], ViewPoint -> {1.8797, -2.3832, 1.4956}}]]

enter image description here

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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