How to change the colors in the plot?

1,380 views (last 30 days)
%How to change the colors in the plot? %I have four curves, and they are black and blue,
%I'm trying to change the color to make it understandable.
plot(tt,xx(:,1),tt,xx(:,2));
grid on
xlabel('time')
ylabel ('Theta')
hold on
plot(ta,xa(:,1),ta,xa(:,2));
legend('theta(position 1)','thetadot(Velocity 1)','theta(position 2)','thetadot(Velocity 2)');

Accepted Answer

David Sanchez
David Sanchez on 1 Aug 2013
plot(tt,xx(:,1),'b',,tt,xx(:,2),'r'); % one blue and the other red
grid on
xlabel('time')
ylabel ('Theta')
hold on
plot(ta,xa(:,1),'y',ta,xa(:,2),'k'); % one yellow one the other black
legend('theta(position 1)','thetadot(Velocity 1)','theta(position 2)','thetadot(Velocity 2)');

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!