Making plots that also show up points/dots for specific coordinates

北城余情 提交于 2019-12-11 17:26:37

问题


I am trying to do a plot in Mathematica of something like

x^2 + y^2

with x, y € [-10, 10].

Besides showing the plot, I'd also like it to include points (for example, (0, 0)) painted in a different color. Point (0,0) would be shown as (0, 0, 0). Point (1, 1) would be shown as (1, 1, 2), etc.

Here is what I am looking for:

How can I achieve this?


回答1:


f[x_, y_] := x^2 + y^2;
t = Flatten[Table[{x, y, f[x, y]}, {x, 0, 10, 1}, {y, 1, 2, 1}], 1];
a = ListPointPlot3D[t, PlotStyle -> PointSize[0.05]];
b = Plot3D[f[x, y], {x, -10, 10}, {y, -10, 10}, 
   ColorFunction -> "MintColors"];
Show[{b, a}]

Your Lines:

f[x_, y_] := x^2 + y^2;
t = Flatten[Table[{x, y, f[x, y]}, {x, 0, 10, 1}, {y, 5, 5, 1}], 1];
l = Table[ Graphics3D[{Thickness[.01], Green, 
           Line[{i, {i[[1]], i[[2]], 200} }]}], {i, t}];

a = ListPointPlot3D[t, PlotStyle -> PointSize[0.05]];
b = Plot3D[f[x, y], {x, -10, 10}, {y, -10, 10}, 
   ColorFunction -> "MintColors"];

Show[{b, a, l}]



来源:https://stackoverflow.com/questions/4221633/making-plots-that-also-show-up-points-dots-for-specific-coordinates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!