Plotting Matrix Data Points with a Specific Color
5 ビュー (過去 30 日間)
古いコメントを表示
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')

0 件のコメント
回答 (1 件)
Debarati Banerjee
2016 年 6 月 23 日
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
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!