Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: voronoi plot with different colors
Replies: 1   Last Post: Dec 23, 2013 12:56 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
kpituso

Posts: 3
Registered: 12/20/13
voronoi plot with different colors
Posted: Dec 20, 2013 4:33 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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=j-1;
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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.