I want to create a 2D scatter plot with loops
2 views (last 30 days)
Show older comments
I want to display discrete values using a scatter plot graph covering 40 columns and 50 rows using a loop(s). (Domain 0<=x<=40) (Range 0<=y<=50.
Ive only managed to achieve 1 row but cannot manage to make more rows. How do i loop for the other 49 rows? (if that is even the best approach to this question).
y = linspace(0,i);
x = 0;
for i = 0:1:50
y = i
end
scatter(0:40,y, 'mo')
0 Comments
Answers (1)
KSSV
on 10 May 2022
[X,Y] = meshgrid(0:40,0:50) ;
scatter(X(:),Y(:),[],Y(:))
scatter(X(:),Y(:),[],X(:))
0 Comments
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!