How to bring a scatter plot to the front of a 3d multiple plot
8 ビュー (過去 30 日間)
古いコメントを表示
Good morning!
I would like to realize this plot with the scatter points covering the line plot (for istance, the green point 35 should cover the black line of the plot, as the 32 does). How can i do? Was trying with the children function but it seems doesnt work with this 3d plot.
0 件のコメント
回答 (1 件)
VINAYAK LUHA
2023 年 9 月 7 日
Hi Daniele,
As per my understanding you wish to superimpose the scatter plot over the line plot,such that line plot lines are not visible inside the scatter plot points, this can be done by plotting the grid-line plot first followed by the scatter points plot -
In the following code if the scatterplot is plotted first, the line plot lines are still visible over the points
xInterval = 5;
yInterval = 5;
zDistance = 2;
[xGrid, yGrid] = meshgrid(-10:xInterval:10, -10:yInterval:10);
zGrid = zDistance * ones(size(xGrid));
figure;
scatter3(xGrid, yGrid, zGrid,100,MarkerFaceColor="flat"); %line 9
hold on
surf(xGrid, yGrid, zGrid,FaceColor="none",LineWidth=1); %line 11
hold off
However, if you do the opposite, plot line plot first and then the scatter plot ,i.e switch places of line 9 and 11, you get the desired result.
Hope this helps
3 件のコメント
VINAYAK LUHA
2023 年 9 月 8 日
Hi Daniele,
Thanks for the update, Is it possible to share some code here ?
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!