Reputation: 39
I used this code to draw every 2D-line in the following picture :
Code:
plot([p1(2),p2(2)],[p1(1),p2(1)],':bs');
Result:
As you can see, every line is composed of:
I want to have a different color for each component of the line.And if possible, how to modify the type too of every component .
For example I want the result to be like this for every line:
How can I plot those colors?
Thank you in advance.
Upvotes: 0
Views: 56
Reputation: 5169
You have to decompose your plot procedure in three operations:
hold on
% First point (blue filled squares)
scatter(p1(2), p1(1), [], 'bs', 'filled')
% Second point point (red filled squares)
scatter(p2(2), p2(1), [], 'rs', 'filled')
% Dashed green line in between
plot([p1(2),p2(2)],[p1(1),p2(1)],'g--');
Best,
Upvotes: 0