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'})

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by