7
$\begingroup$

I find the two graphs (see below) in Plot3D's help page elegant and appealing. How can I reproduce it? I read the whole help page but didn't find how the graphs were made.

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ Welcome to the Mathematica Stack Exchange. Surely there are plenty of examples on the Plot3D page. What exactly are you having difficulty with? The color scheme, mesh lines, labeling? Please be more specific. Thanks. $\endgroup$
    – Syed
    Commented Jan 14 at 7:12
  • 5
    $\begingroup$ I agree that WRI should include code used to generate these plots. But you can always do this: simply copy the image from the help page and paste it into your open notebook and give it a name. say p. Now do myopts = AbsoluteOptions[p] which gives you all options used to generate the plot. But without knowing the function used it is hard to make progress. Here is screen shot !Mathematica graphics you can now use same options in your Plot3D command. $\endgroup$
    – Nasser
    Commented Jan 14 at 8:03
  • 2
    $\begingroup$ @Nasser Interesting, Boxed can be used to draw specific faces of the box... which is an undocumented feature. $\endgroup$
    – kirma
    Commented Jan 14 at 14:06

1 Answer 1

17
$\begingroup$

When all else fails you can construct graphics explicitly using Show, Graphics3D and Plot3D:

Show[
 Graphics3D[
  {Line[
    {{{-3.5, -3.5, -2}, {-3.5, 3.5, -2}, {3.5, 
       3.5, -2}, {3.5, -3.5, -2}, {-3.5, -3.5, -2},
      {-3.5, -3.5, 2}, {-3.5, 3.5, 2}, {3.5, 3.5, 2}, {3.5, 
       3.5, -2}},
     {{-3.5, 3.5, 2}, {-3.5, 3.5, -2}}}],
   Dashing[1/50],
   Line[{{0, 0, -2}, {0, 0, -Sin[-1/2]}}],
   PointSize[Large],
   Point[{0, 0, -Sin[-1/2]}],
   Line[{{3.5, 0, -2}, {0, 0, -2}, {0, -3.5, -2}}],
   Text[f[x, y], {0, 0, -Sin[-1/2]}, {0, -1.5}],
   Text[x, {0, -3.5, -2}, {1, 1}],
   Text[y, {3.5, 0, -2}, {-2, 1}],
   Text[z, {-3.5, -3.5, 0}, {2, 0}],
   Text[reg, {1.7, -1.7, -2}]},
  BaseStyle -> {16, Bold, Italic, FontFamily -> "Times"},
  Boxed -> False, ViewPoint -> {1, -2, 1.5}],
 Plot3D[{-Sin[x] - Sin[y - 1/2], -2.001},
  {x, y} \[Element] Disk[{0, 0}, Pi],
  PlotStyle -> {RGBColor[{0.75, 0.75, 1, 0.6}], White},
  BoundaryStyle -> None,
  Lighting -> "Accent",
  Mesh -> 5, PlotPoints -> 50, MeshStyle -> White]]

enter image description here

Here Graphics3D constructs the sides of the box we want, dashed lines, the point on the surface, and places text (styled with BaseStyle) at relevant offset directions from specific points.

Plot3D takes care of the actual surface, the plotting region (including the "shadow" under it) and their styling and lighting. If you don't want a partially drawn box or other extra annotations you can just use Plot3D part and remove the rest.

$\endgroup$

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.