How can I modify the size of label in boxplot?

9 views (last 30 days)
I created a boxplot with by the following function:
h= boxplot([tas_O2,tas_DeQM,tas_KeQM,tas_Dv,tas_Kv],'labels',{'Obs','M1_e','M2_e','M1_v','M2_v'});
I would like to change the original size of the labels. Could someone write me what I should to do?

Answers (1)

Meet
Meet on 1 Aug 2024
Hi Szabó,
You can modify the size of the labels in a boxplot by adjusting the 'axes' properties and setting the corresponding font size for the 'XAxis' and 'YAxis' labels.
For Example:
h = boxplot([tas_O2, tas_DeQM, tas_KeQM, tas_Dv, tas_Kv], 'labels', {'Obs', 'M1_e', 'M2_e', 'M1_v', 'M2_v'});
% Get the current axes
ax = gca;
% Set the font size for the x-axis labels
ax.XAxis.FontSize = 12;
% Set the font size for the y-axis labels
ax.YAxis.FontSize = 12;
For more information, you can refer to the following documentation link:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!