Multiple boxplots on one figure

3 views (last 30 days)
Caitlin Miller
Caitlin Miller on 14 Apr 2019
Answered: A. Sawas on 14 Apr 2019
I need to generate a boxplot that compares the windspeeds from the recent hurricane (Table 1) and the hurricane that occurred last year (Table 2).
Table 1: Windspeeds and distances from hurricane center for recent hurricane
Windspeed: 30,35,41,80,52,50,29,73,33,35,46,28,53,31,25
Distance: 55,50,49,8,35,38,60,26,46,50,41,65,37,57,70
Table 2: WIndspeed and distance from hurricane center for hurricane that occured last year
Windspeed: 22,33,41,89,62,59,25,88,35,34,52,37,60,29,31
Distance: 51,50,33,7,35,41,54,29,43,48,39,54,36,62,83
  2 Comments
Geoff Hayes
Geoff Hayes on 14 Apr 2019
Caitlin - I'm not sure what your question is. Have you tried to use boxplot?
Caitlin Miller
Caitlin Miller on 14 Apr 2019
here is what I have tried.... i dont know how to have 2 sets of data (W1, and W2) both displayed on one boxplot, side by side...
W1 = [30 35 41 80 52 50 29 73 33 35 46 28 53 31 25];
D1 = [55 50 49 8 35 38 60 26 46 50 41 65 37 57 70];
W2 = [22 33 41 89 62 59 25 88 35 34 52 37 60 29 31];
D2 = [51 50 33 7 35 41 54 29 43 48 39 54 36 62 83];
figure(1)
boxplot([W1,W2],'notch','on','label',['recent windspeeds','last years windspeeds'])
title 'comparing recent windseeds with last years'
plot1.jpg

Sign in to comment.

Answers (1)

A. Sawas
A. Sawas on 14 Apr 2019
boxplot([W1;W2]','notch','on','Labels',{'recent windspeeds','last years windspeeds'})

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!