Multiple boxplots on one figure

3 次查看(过去 30 天)
Caitlin Miller
Caitlin Miller 2019-4-14
回答: A. Sawas 2019-4-14
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 个评论
Geoff Hayes
Geoff Hayes 2019-4-14
Caitlin - I'm not sure what your question is. Have you tried to use boxplot?
Caitlin Miller
Caitlin Miller 2019-4-14
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

请先登录,再进行评论。

回答(1 个)

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

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by