6
$\begingroup$

Is it possible to remove the default white space around a 3D graphics, inside the Manipulate box ?

Here's a small MWE to show the white border I'm talking about :

Manipulate[
SphericalPlot3D[1, {theta, 0, Pi}, {phi, t, 2Pi + t},
    Mesh -> {7, 7},
    MaxRecursion -> ControlActive[2, 5],
    PlotRange -> All,
    Boxed -> False,
    Axes -> None,
    SphericalRegion -> True,
    Method -> {"RotationControl" -> "Globe"},
    ImageSize -> {400, 400},
    Background -> Black],
{{t, 0, Style["t", 10]}, 0, 2Pi, 0.01}
]

enter image description here

In this case, I would prefer to not have that useless white space between the black background and the manipulate frame.

$\endgroup$
2
  • $\begingroup$ FrameMargins -> None, makes them smaller $\endgroup$
    – Jason B.
    Commented Mar 8, 2016 at 14:10
  • $\begingroup$ @JasonB, FrameMargins -> None is already much nicer, thanks ! But there's still a small white margin left. $\endgroup$
    – Cham
    Commented Mar 8, 2016 at 14:15

3 Answers 3

4
$\begingroup$

Using this undocumented option suggested by MichaelE2, we can change the color of the border to the same as the background color of the plot:

Manipulate[
 SphericalPlot3D[1, {theta, 0, Pi}, {phi, t, 2 Pi + t},
      Mesh -> {7, 7},
      MaxRecursion -> ControlActive[2, 5],
      PlotRange -> All,
      Boxed -> False,
      Axes -> None,
      SphericalRegion -> True,
      Method -> {"RotationControl" -> "Globe"},
      ImageSize -> {400, 400},
      Background -> Black],
 {{t, 0, Style["t", 10]}, 0, 2 Pi, 0.01}, 
 Method -> {"ContentAreaBackground" -> Black}]

enter image description here

But this option does not work for version 7, so it is then necessary to set the FrameMargins to a small negative value,

Manipulate[
   SphericalPlot3D[1, {theta, 0, Pi}, {phi, t, 2 Pi + t},
        Mesh -> {7, 7},
        MaxRecursion -> ControlActive[2, 5],
        PlotRange -> All,
        Boxed -> False,
        Axes -> None,
        SphericalRegion -> True,
        Method -> {"RotationControl" -> "Globe"},
        ImageSize -> {400, 400},
        Background -> Black],
   {{t, 0, Style["t", 10]}, 0, 2 Pi, 0.01},
   FrameMargins -> #
   ] & /@ {Automatic, None, -5}

enter image description here

$\endgroup$
6
  • $\begingroup$ What would be the right negative value to remove all the white space, but not more ? $\endgroup$
    – Cham
    Commented Mar 8, 2016 at 14:14
  • $\begingroup$ For this example, it seems that FrameMargins -> {{-5, -5}, {-3, -3}} is just right, but I don't know how universal that is $\endgroup$
    – Jason B.
    Commented Mar 8, 2016 at 14:16
  • $\begingroup$ This is weird. The frame isn't regular ? $\endgroup$
    – Cham
    Commented Mar 8, 2016 at 14:18
  • $\begingroup$ @Cham, no, you can see that by setting it FrameMargins -> -3. It might be related to the aspect ratio of the panel. $\endgroup$
    – Jason B.
    Commented Mar 8, 2016 at 14:20
  • $\begingroup$ Hmm, the Method -> {"ContentAreaBackground" -> Black} does nothing on my system. Not even a warning/error message (version 7). I still get the white default margin. There's something fishy in my code. $\endgroup$
    – Cham
    Commented Mar 8, 2016 at 14:29
3
$\begingroup$

What about this:

 Framed[Manipulate[
  SphericalPlot3D[1, {theta, 0, Pi}, {phi, t, 2 Pi + t}, 
   Mesh -> {7, 7}, MaxRecursion -> ControlActive[2, 5], 
   PlotRange -> All, Boxed -> False, Axes -> None, 
   SphericalRegion -> True, Method -> {"RotationControl" -> "Globe"}, 
   ImageSize -> {400, 400}, 
   Background -> Black], {{t, 0, Style["t", 10]}, 0, 2 Pi, 0.01}, 
  Paneled -> False], FrameStyle -> {GrayLevel[0.7], Thickness[3]}]

yielding this:

enter image description here

Have fun!

$\endgroup$
2
  • $\begingroup$ Hmm, while it is good to know these options, I don't want to change all the Manipulate frame itself. I just want to remove the white space around the picture. $\endgroup$
    – Cham
    Commented Mar 8, 2016 at 14:10
  • $\begingroup$ Ah, I understood you incorrectly. $\endgroup$ Commented Mar 8, 2016 at 14:12
0
$\begingroup$
Manipulate[
 SphericalPlot3D[1, {theta, 0, Pi}, {phi, t, 2 Pi + t}, 
  Mesh -> {7, 7}, MaxRecursion -> ControlActive[2, 5], 
  PlotRange -> All, Boxed -> False, Axes -> None, 
  SphericalRegion -> True, Method -> {"RotationControl" -> "Globe"}, 
  ImageSize -> {400, 400}, 
  Background -> Black], {{t, 0, Style["t", 10]}, 0, 2 Pi, 0.01},
 Paneled -> False]
$\endgroup$
1
  • $\begingroup$ Paneled -> False remove the whole Manipulate frame, which is not what we want here. $\endgroup$
    – Cham
    Commented Mar 8, 2016 at 14:26

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.