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?
Answer
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 inEpilog
?
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.)
Comments
Post a Comment