4
$\begingroup$

I want to place a caption at the bottom of a Plot3D graphic that doesn't move as I rotate the plot with the mouse. I have tried two approaches, neither of which is satisfactory.

My first approach is to position Graphics3D@Text under the 3D plot. This method forces in the caption's position to move relative to the 3D plot. Here is my stripped down code for this attempt:

Show[
 Plot3D[(y^2 - x^2 - 1/6 x^3), {x, -8, 5}, {y, -6, 6}, 
 MeshFunctions -> {#3 &}, Mesh -> 60, PlotPoints -> 50],

 Graphics3D@Text[Style["Caption goes here", 14,
 Black, FontFamily -> "Helv"], {9, -10, -10}]
]

My second approach is to use PlotLabel in Plot3D. Although the label remains relatively fixed in position, it appears at the top of the 3D plot and I want it to appear at the bottom of the 3D plot. Here is my stripped down code for this attempt:

Plot3D[(y^2 - x^2 - 1/6 x^3), {x, -8, 5}, {y, -6, 6}, 
 MeshFunctions -> {#3 &}, Mesh -> 60, PlotPoints -> 50,
 PlotLabel -> Style["Caption goes here", 14, FontFamily -> "Helv"]]

Any suggestions?

$\endgroup$
5
$\begingroup$

Update

From the comments what I believe you want is the rotating window not to resize as you rotate. This happens because the default RotatingAction is "Fit". You need it to be "Clip".

Labeled[
 Plot3D[(y^2 - x^2 - 1/6 x^3), {x, -8, 5}, {y, -6, 6}, 
  MeshFunctions -> {#3 &}, Mesh -> 60, PlotPoints -> 50,
  RotationAction -> "Clip"],
 Style["Caption goes here", 14, FontFamily -> "Helv"],
 Bottom]

Now the window is not resized and the label does not jump around.

Original Post

You may use Inset in the Epilog option.

Plot3D[(y^2 - x^2 - 1/6 x^3), {x, -8, 5}, {y, -6, 6}, 
 MeshFunctions -> {#3 &}, Mesh -> 60, PlotPoints -> 50,
 Epilog -> {Inset[Style["Caption goes here", 14, Black, FontFamily -> "Helv"], 
    {Center, Bottom}, {Center, Bottom}]}
]

enter image description here

Hope this helps.

$\endgroup$
  • $\begingroup$ Your suggestion is helpful but does not do what I want. Let me rephrase my original question. I would like the caption to behave like a FrameLabel in 2D graphics. Can my 3D plot be rotated in some sort of fixed frame and the caption be positioned below such a fixed frame? $\endgroup$ – Stephen Jul 28 '16 at 13:08
  • $\begingroup$ @Stephen Have you seen Labeled. $\endgroup$ – Edmund Jul 28 '16 at 13:17
  • 1
    $\begingroup$ @Stephen Actually, you just need to add the RotationAction option to your PlotLabel code. $\endgroup$ – Edmund Jul 28 '16 at 13:22
  • $\begingroup$ @Stephen See update. $\endgroup$ – Edmund Jul 28 '16 at 13:30
  • 1
    $\begingroup$ @Stephen I believe the default is "Globe". You can check with Method /. AbsoluteOptions[g]. Where g is the result of your Plot3D, sog = Plot3D[...]. $\endgroup$ – Edmund Jul 28 '16 at 14:07

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.