Boxchartで各Boxの色を変えたい
이전 댓글 표시
現在、以下のスクリプトを作成しBoxchartを作成しています。各Boxの色を変えたいのですが(例えば、左から赤・青・緑・紫)、うまくできません。Boxplotではなく、Boxchartでの方法を教えていただきたいです。よろしくお願いいたします。

tbl1 = readtable('File.csv');%フォルダー内から呼び出し(複数のシートに分ける必要)
TimeOrder = {'A','B','C','D'};%横軸を定義
tbl1.Time = categorical(tbl1.Time,TimeOrder);%データを時間ごとで分類
boxchart(tbl1.Time,tbl1.Variable,'GroupByColor',tbl1.Protocol)%BoxChartの作成
b1 = boxchart(tbl1.Time,tbl1.Variable,'GroupByColor',tbl1.Protocol) %BoxChart格納
meanValue1 = groupsummary(tbl1.Varible,tbl1.Time,'mean');
hold on
plot(meanValue1,'-ok')
plot1 = plot(meanValue1,'-ok')
plot1.LineWidth = 1;
hold off
title('%TQ');
b1.BoxFaceColor = '#A2142F'; %ボックス色の変更
b1.MarkerStyle = 'none'; %マーカースタイルの変更
ylim([0 100]) %y軸の範囲を変更
b1 = gca;%フォントサイズの変更
b1.FontSize = 14;
b1.FontName = 'Times New Roman';%フォントタイプの変更
b1.TickDir = 'out'%メモリ線の位置
b1.FontWeight = 'bold';%ボールド体に変更
b1.XTickLabel = [];
yticks(0:20:100);
b1.LineWidth = 1; % 軸の枠線の太さを設定
b1.XRuler.Axle.LineWidth = 1; % x軸のメモリの太さを設定
b1.YRuler.Axle.LineWidth = 1
댓글 수: 2
Kojiro Saito
2024년 7월 28일
再現できるデータがあればコミュニティでも回答しやすくなると思いますが、色データで与えているtbl1.Protocolにはどのようなデータが含まれていますか?
Raki
2024년 7월 29일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


