Boxchartで各Boxの色を変えたい
Mostrar comentarios más antiguos
現在、以下のスクリプトを作成し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 comentarios
Kojiro Saito
el 28 de Jul. de 2024
再現できるデータがあればコミュニティでも回答しやすくなると思いますが、色データで与えているtbl1.Protocolにはどのようなデータが含まれていますか?
Raki
el 29 de Jul. de 2024
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


