how to plot group boxplot

a = readtable('Sample data2.xlsx')
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
a = 166×15 table
INSITU ERA5 NCAR_NCEP MERRA2 CERES INSITU_1 ERA5_1 NCAR_NCEP_1 MERRA2_1 CERES_1 INSITU_2 ERA5_2 NCAR_NCEP_2 MERRA2_2 CERES_2 ______ ______ _________ ______ ______ ________ ______ ___________ ________ _______ ________ ______ ___________ ________ _______ 83.649 225.17 129.05 93.975 112.7 115.93 182.09 155.78 114.85 125.85 83.649 225.17 129.05 93.975 112.7 98.304 227.49 155.95 102.3 130.35 110.41 163.31 142.32 125.62 125.1 98.304 227.49 155.95 102.3 130.35 107.76 213.89 160.93 100 129.88 108.8 180.38 144.28 126.83 131.97 107.76 213.89 160.93 100 129.88 93.286 207.96 124.7 71.175 97.725 112.49 194.44 143.95 122.53 135.55 115.93 182.09 155.78 114.85 125.85 78.649 191.09 106.72 71.1 82.875 108.51 204.66 140.53 91.6 124.85 110.41 163.31 142.32 125.62 125.1 74.113 197.77 107.03 81.85 79.225 116.82 187.62 153.32 121.1 125.05 108.8 180.38 144.28 126.83 131.97 82.736 206.86 119.78 86.15 104.4 108.85 164.5 147.22 126.2 128.03 112.49 194.44 143.95 122.53 135.55 87.11 222.08 140.85 96.475 111.28 108.6 152.88 142.62 128.82 127.83 108.51 204.66 140.53 91.6 124.85 108.25 213.98 149.2 101.62 121.17 106.77 191.26 138.97 116.67 144.57 93.286 207.96 124.7 71.175 97.725 118.93 207.61 156.57 111.33 122.58 107.28 215.08 139.47 92 122.2 78.649 191.09 106.72 71.1 82.875 87.996 208.39 124.12 74.4 90.825 122.2 187.5 157.25 109.7 124.67 74.113 197.77 107.03 81.85 79.225 74.457 190.97 104.28 72.925 79.475 114.8 181.57 153.65 130.78 123.08 82.736 206.86 119.78 86.15 104.4 72.081 193.92 106.85 80.25 93.7 105.6 179.8 137.28 124.33 134.12 87.11 222.08 140.85 96.475 111.28 85.703 204.86 123.97 85.325 92.45 111.72 193.69 141.15 114.97 145.35 108.25 213.98 149.2 101.62 121.17 92.277 217.1 145.7 100.25 98 100.54 198.7 130.72 91.875 127.3 118.93 207.61 156.57 111.33 122.58 103.37 212.33 149.95 96.2 121.58 118.61 186.02 152.78 119.62 120.8 116.82 187.62 153.32 121.1 125.05
b = 'samdig.png'
b = 'samdig.png'
imshow(b)
I want matlab code to plot the boxplot of above data to look the above diagram but in 'notched form'. Kindly help me out. Thanks.

5 Comments

In the figure, I see 3 groups (dry/wet/Annual) and 5 subgroups (defined by legend). It's not clear how the table you shared should be divided into groups and subgroups.
Ankit's answer below shows you some good starting points to get you started.
the headings with subscript are dry season data as group 1
Those with subscript 1 are wet season data as group 2
Those with subscript 2 are annual data as group 3
the headings, Insitu, ERA5, NCAR/NCEP, MERRA2 and CERES are 5 subgroups to be used as legends.
I don't understand that. Please list the headings that appear in the table that belong to each group.
Ankit
Ankit on 19 Jan 2022
Edited: Ankit on 19 Jan 2022
This is what I think Ojo Olusola means
INSITU, ERA5, NCAR_NCEP, MERRA2, CERES - dry
INSITU_1, ERA5_1, NCAR_NCEP_1, MERRA2_1, CERES_1 - wet
INSITU_2, ERA5_2, NCAR_NCEP_2, MERRA2_2, CERES_2 - Annual
Yes, that is exactly what I mean.

Sign in to comment.

Answers (1)

Ankit
Ankit on 17 Jan 2022
Edited: Ankit on 17 Jan 2022
Have a look over the below link. There are sufficient infos available on MATLAB Website
Also you can find some ready made function shared on MATLAB File Exchange
Info: 'boxplot' requires Statistics and Machine Learning Toolbox.
Below submission doesn't required any Toolbox.

3 Comments

I am not satisfied with this answer. Kindly use the attached data. Thanks
To add to Ankit's list,
Ankit
Ankit on 18 Jan 2022
Edited: Ankit on 18 Jan 2022
@Ojo Olusola you need to try the above mentioned functions/links by me and Adam by yourself. In case you face problem then we can help further..

Sign in to comment.

Products

Release

R2021a

Tags

Asked:

on 17 Jan 2022

Commented:

on 19 Jan 2022

Community Treasure Hunt

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

Start Hunting!