Por lo que vale la pena, me gusta la solución simple también.Además de que es fácil de utilizar la misma función de colorear para la superficie y los puntos:
g = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, Mesh -> {1, 4}, Boxed -> False, ColorFunction -> "Rainbow"];
p = ListPointPlot3D[Table[{x, y, Sin[x + y^2]}, {x, -3, 3, (3 - (-3))/(1 + 1)}, {y, -2, 2, (2 - (-2))/(4 + 1)}], ColorFunction -> "Rainbow", PlotStyle -> PointSize[Large]];
Show[g, p]
Editar: Si queremos hacer esto en un myPlot3D personalizado, creo que el siguiente debería hacer:
myPlot3D[f_, {x_, xmin_, xmax_}, {y_, ymin_, ymax_},
Mesh -> {i_Integer, j_Integer}, opts : OptionsPattern[]] :=
Module[{g =
Plot3D[f, {x, xmin, xmax}, {y, ymin, ymax}, Mesh -> {i, j},
[email protected][{opts}, Options[Plot3D]]],
stx = (xmax - xmin)/(i + 1),
sty = (ymax - ymin)/(j + 1), pts},
pts = ListPointPlot3D[
Table[{x, y, f}, {x, xmin + stx, xmax - stx, stx}, {y,
ymin + sty, ymax - sty, sty}],
[email protected][{opts}, Options[ListPointPlot3D]]];
Show[g, pts]];
Tenga en cuenta que las opciones se aplican a ambos gráficos, pero se filtran primero. También eliminé los puntos en el contorno de la trama. Por ejemplo,
myPlot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, Mesh -> {4, 10},
Boxed -> False, ColorFunction -> "Rainbow", Axes -> False,
PlotStyle -> PointSize[Large]]
dará como resultado
me gusta demasiado :) –
@FelixCQ + 1 Agradable –
@Felix Tratando de generalizar esto en mi respuesta. ¿Ves una mejor manera? –