Changing Plot colors while using fitlm
I’m trying to plot 4 different sets of data with a linear regression for each. I used the fitlm command to find hte linear regression. My problem arises with the plot all being the same color for each set of data, blue for the points and red for the regression line. I need them to be different colors for each data set for clarity sake.
data=readmatrix(‘straingage_caldata.csv’);
c1F=data(:,1);
c1V=data(:,2);
c3F=data(:,3);
c3V=data(:,4);
c4F=data(:,5);
c4V=data(:,6);
c5F=data(:,7);
c5V=data(:,8);
c1LR=fitlm(c1F,c1V)
c3LR=fitlm(c3F,c3V)
c4LR=fitlm(c4F,c4V)
c5LR=fitlm(c5F,c5V)
figure
hold on
plot(c1LR,"r");
plot(c3LR);
plot(c4LR);
plot(c5LR);
legend(‘Crane 1′,’Crane 1 Lin Reg’,’Crane 3′,’Crane 3 Lin Reg’,’Crane 4′,’Crane 4 Lin Reg’,’Crane 5′,’Crane 5 Lin Reg’,"Location","SouthEast")
thanksI’m trying to plot 4 different sets of data with a linear regression for each. I used the fitlm command to find hte linear regression. My problem arises with the plot all being the same color for each set of data, blue for the points and red for the regression line. I need them to be different colors for each data set for clarity sake.
data=readmatrix(‘straingage_caldata.csv’);
c1F=data(:,1);
c1V=data(:,2);
c3F=data(:,3);
c3V=data(:,4);
c4F=data(:,5);
c4V=data(:,6);
c5F=data(:,7);
c5V=data(:,8);
c1LR=fitlm(c1F,c1V)
c3LR=fitlm(c3F,c3V)
c4LR=fitlm(c4F,c4V)
c5LR=fitlm(c5F,c5V)
figure
hold on
plot(c1LR,"r");
plot(c3LR);
plot(c4LR);
plot(c5LR);
legend(‘Crane 1′,’Crane 1 Lin Reg’,’Crane 3′,’Crane 3 Lin Reg’,’Crane 4′,’Crane 4 Lin Reg’,’Crane 5′,’Crane 5 Lin Reg’,"Location","SouthEast")
thanks I’m trying to plot 4 different sets of data with a linear regression for each. I used the fitlm command to find hte linear regression. My problem arises with the plot all being the same color for each set of data, blue for the points and red for the regression line. I need them to be different colors for each data set for clarity sake.
data=readmatrix(‘straingage_caldata.csv’);
c1F=data(:,1);
c1V=data(:,2);
c3F=data(:,3);
c3V=data(:,4);
c4F=data(:,5);
c4V=data(:,6);
c5F=data(:,7);
c5V=data(:,8);
c1LR=fitlm(c1F,c1V)
c3LR=fitlm(c3F,c3V)
c4LR=fitlm(c4F,c4V)
c5LR=fitlm(c5F,c5V)
figure
hold on
plot(c1LR,"r");
plot(c3LR);
plot(c4LR);
plot(c5LR);
legend(‘Crane 1′,’Crane 1 Lin Reg’,’Crane 3′,’Crane 3 Lin Reg’,’Crane 4′,’Crane 4 Lin Reg’,’Crane 5′,’Crane 5 Lin Reg’,"Location","SouthEast")
thanks fitlm, plot MATLAB Answers — New Questions