Hello,
How do I create a 5x4 circles in a grid formate with specific circles having different colors

Antworten (1)

KSSV
KSSV am 7 Jul. 2021

0 Stimmen

th = linspace(0,2*pi) ;
r = 0.1 ;
xc = r*cos(th) ;
yc = r*sin(th) ;
x = 1:5 ;
y = 1:4 ;
[X,Y] = meshgrid(x,y) ;
figure
hold on
for i = 1:4
for j = 1:5
patch(X(i,j)+xc,Y(i,j)+yc,rand(1,3))
end
end
Or
th = linspace(0,2*pi) ;
r = 0.1 ;
xc = r*cos(th) ;
yc = r*sin(th) ;
x = 1:5 ;
y = 1:4 ;
[X,Y] = meshgrid(x,y) ;
c = sqrt(X.^2+Y.^2) ;
scatter(X(:),Y(:),100,c(:),'filled')

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 7 Jul. 2021

Beantwortet:

am 7 Jul. 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by