kpituso
Posts:
3
Registered:
12/20/13


voronoi plot with different colors
Posted:
Dec 20, 2013 4:33 AM


Hi, I've got this:
n=5000; %No. of grains x=2*rand(1,n); y=rand(1,n); D=[x;y]'; [v,c]=voronoin(D); figure(1) col(:,:,1) = rand(n); col(:,:,2) = rand(n); col(:,:,3) = rand(n); j=length(col); for i = 1:length(c) if all(c{i}~=1) j=j1; patch(v(c{i},1),v(c{i},2),(col(i,j,:))); %use color col(i,j). end end
I want to generate voronoi diagram with different colors each grains. I'm not sure that this code is correct by using color col(i,j,:). I have an idea that I should use 24 bits color matrix in #RRGGBB form but I have no idea to mix it into this code.
Any idea? Kotchakorn

