# Plotting Matrix Data Points with a Specific Color

4 views (last 30 days)
Fergus Moynihan on 14 Jun 2016
Answered: Debarati Banerjee on 23 Jun 2016
Just wondering if there's a way to graph the data points listed in bal_1 in different colors so as to differentiate one row from another. The current code generates an image like the one you see below, and I'd just like to add different colors so I can distinguish one row from another. For instance, one row to be blue, the next to be red, etc.
bal_1 = [0.9445 0.9274 0.9379 0.8823;
0.9407 0.9348 0.9325 0.9313;
0.9185 0.9296 0.9195 0.9391;
0.9462 0.9294 0.9409 0.9426];
bal_t1 = transpose(bal_1); %transpose of all data for anova1 testing
balloons_1 = {'#2' '#3' '#5' '#9'};
x{1} = 1:size(bal_t1,2);
figure(2)
plot(x{1}, bal_t1, '+b') % Plot Matrix
axis([0 5 0.875 1]) % Set Axis Limits
set(gca, 'XTick',x{1}, 'XTickLabel',{'#2' '#3' '#5' '#9'}) % Set Tick Labels
xlabel('Balloon Number','FontSize',10,'FontWeight','bold')
ylabel('Pressure Change Rate (kPa/min)','FontSize',12,'FontWeight','bold')

Debarati Banerjee on 23 Jun 2016
Just changing the plot command a bit may work for you:
plot(x{1}, bal_t1(:,1), '+b',x{1}, bal_t1(:,2), '+r',x{1}, bal_t1(:,3), '+g',x{1}, bal_t1(:,4), '+m')
Cheers
Debarati