16

I am trying to visualize 3D points with Plot3D using the option Epilog. If you check the options of Plot3D ( Options[Plot3D] ), it can be seen that Epilog is one of the options of Plot3D. But when implementing this option not result as expected. for example:

  data = Flatten[
  Table[{i, j, i^2 + j^2}, {i, -2, 2, .5}, {j, -2, 2, .5}], 1];
    Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2}, 
     Epilog -> {PointSize[Large], Point[data]}, PlotRange -> All]

Of course there is another ways (like using Show), but the question is why Plot3D does not accept its own option?

Basheer Algohi
  • 19,917
  • 1
  • 31
  • 78
  • 5
    "In three-dimensional graphics, two-dimensional graphics primitives can be specified by the Epilog option. The graphics primitives are rendered in a 0,1 coordinate system": Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2}, Epilog -> {PointSize[Large], Point[{.5, .5}]}, PlotRange -> All] – Kuba Jul 08 '14 at 08:13
  • @kuba Still the points are in the {x,y} plan. I am looking to have the points in 3D. you can see the difference between Show[ListPointPlot3D[ Table[{i, j, i^2 + j^2}, {i, -2, 2, .1}, {j, -2, 2, .1}], PlotStyle -> Directive[PointSize[0.02], Red]], Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2}]] and Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2}, Epilog -> {PointSize[Large], Point[Table[{i, j}, {i, -2, 2, .1}, {j, -2, 2, .1}]]}, PlotRange -> All] – Basheer Algohi Jul 08 '14 at 08:32
  • 2
    @Algohi If you want a point, just use Show and Graphics3D[Point@something]. – Öskå Jul 08 '14 at 08:37
  • closely related: 41439 – Kuba Jul 08 '14 at 08:38
  • See here for example- as Öskå said, use show... – ciao Jul 08 '14 at 08:39
  • @Öskå it is easier to use show[plot3d and listpoinplot3d]. I am just wandering why plot3d does not accept its own option. – Basheer Algohi Jul 08 '14 at 08:47
  • @Algohi At least with Graphics3D you can do more than just points ;) – Öskå Jul 08 '14 at 08:50
  • @Öskå Yes, Graphics3D can do more than just points :) – Basheer Algohi Jul 08 '14 at 08:54

1 Answers1

25

Why does Plot3D not accept its own option?

But it does accept it just fine, as Kuba's comment shows:

Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
 Epilog -> {PointSize[Large], Point[{.5, .5}]}, PlotRange -> All]

I guess you mean to ask,

Why does Plot3D not accept 3D graphics in Epilog?

Because Epilog is for drawing things in front of the plot, just as Prolog is for drawing things behind the plot. So, the ordering is: a flat 2D layer for Prolog, then the 3D plot, then a flat 2D layer for Epilog. (Like a sandwich... mmm.) If Epilog accepted 3D graphics, then they would exist in the same space as the plot itself, and would not always appear in front.

(Actually, Mathematica could in principle allow 3D graphics in Epilog by rendering them with the same viewpoint but on a separate buffer and then compositing the result on top of the plot, so that you would always see them even when they are geometrically behind the plot. But I imagine that would be rarely useful and often confusing.)