Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with Plotting multiple lines

Status
Not open for further replies.

bombardment

Mechanical
Joined
Nov 16, 2009
Messages
12
Location
US
I am plotting 6 curves on one plot. 5 of those will be using the left axis and the 1 using the right axis. Each line will have a different color. The code that I have is giving me colors that do not match up with the lines.

M = csvread(filenameAndDir,1,0);
t=M(:,1)/60;
T=M(:,2);
T1=M(:,3);
T2=M(:,4);
T3=M(:,5);
T4=M(:,6);
T5=M(:,7);
A=M(:,8);

[h]=subplot(2,1,[1,2]);
annotation('textbox',[.5 .9 .1 .1],'edgecolor','none','string',filename);

set(gcf,'DefaultAxesColorOrder',[0 1 0;0 0 1;1 0 0;1 1 0;0 0 0;0 1 1;1 0 1]);
[AX,H1,H2]=plotyy(t,T,t,A);
hold on;
plot(t,T1,t,T2,t,T3,t,T4,t,T5);
hold off;
grid on;
set(AX(1),'YLim',[20 120],'YTick', [20 40 60 80 100 120]);
set(AX(2),'YLim',[0 100], 'YTick', [0 10 20 30 40 50 60 70 80 90 100]);
ylabel(AX(1),'Temperature (C)')
ylabel(AX(2),'Heat (kJ)')
xlabel('Time (mins)')
title('Heat Production')
legend('Temp1','Temp2','Temp3','Temp4','Avg','Water','Heat',1);

The way that I want it is:

T-Green
T1-Blue
T2-Red
T3-Yellow
T4-Black
T5-Cyan
Q-Magenta(what is the code for orange?)

Any help would be very much appreciated. Thanks in advance.
 
Just type the color after your pair of values
plot(t,T1,'gr',t,T2,'bl',t,T3,'r',t,T4,'ye',t,T5,'cy');

and so on. but look in the help for plot there should be everthing explained.

Regards
Phaneas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top