How to give different colors to different tracts?
Show older comments
Hi.
I have some tracts and i can plot them using plot3. I would like to give to each tract a color, using some information about the relative distance between the first and last point of that tract.
For example: Tract1 goes from (1,1,1) to (6,8,12). So: Diff is (5,7,11).
I know that RGB codes are something like [1 0 0] or [1 0.4 0.6]. With this i made [(Diff(1)/(Diff(1)+Diff(2)+Diff(3)) (Diff(2)...) (Diff(3)...)] but it gives me this error: 'Error in color/linetype argument'.
How can i solve this?
Thanks in advance
3 Comments
Gustavo
on 3 Jul 2013
the cyclist
on 3 Jul 2013
You could put this as an answer (rather than a comment), and accept it.
Jan
on 4 Jul 2013
j=1:size(TRACTS{i}) is at least confusing: size() replies a vector and what do you expect as output of: 1:[22,23]? So better define the wanted dimension in the size() command.
There is no reason to clear 'V'. A pre-allocation would be much more important instead:
V = zeros(size(TRACTS{i}, 1), 3);
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Performance 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!