Mahdi
Mahdi

Reputation: 1827

How can change color of plotted line in matlab

I'm using arrow.m for a line with direction. I don't how to change color of line when using arrow.m. the original line's properties doesn't work. If you have any suggestion please advice me?

link of arrow.m

http://www.mathworks.com/matlabcentral/fileexchange/278-arrow-m

Upvotes: 2

Views: 444

Answers (2)

chessbot
chessbot

Reputation: 436

Try modifying the arrow's EdgeColor:

h = arrow([0 0], [2 3]);
set(h, 'EdgeColor', [1 0 0]); // the line is now red
set(h, 'FaceColor', [0 1 0]); // the arrowhead is now green

Upvotes: 2

m_power
m_power

Reputation: 3204

If you take a look at the comments on the link of the arrow.m file :

%Here goes the view setting 
view([1 1 1])

arrow([0 0 0],xvector, 'EdgeColor','k','FaceColor','k') 
arrow([0 0 0],yvector, 'EdgeColor','b','FaceColor','b') 
arrow([0 0 0],zvector, 'EdgeColor','r','FaceColor','r')

You should try to play with the EdgeColor and the FaceColor parameters after the view([...]) command

Upvotes: 2

Related Questions