How to bring a scatter plot to the front of a 3d multiple plot
8 views (last 30 days)
Show older comments
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 Comments
Answers (1)
VINAYAK LUHA
on 7 Sep 2023
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 Comments
VINAYAK LUHA
on 8 Sep 2023
Hi Daniele,
Thanks for the update, Is it possible to share some code here ?
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!