필터 지우기
필터 지우기

Plotting multiple Box plots on a single figure for multiple conditions

조회 수: 1 (최근 30일)
Sean Byrne
Sean Byrne 2020년 8월 27일
답변: Ayush Gupta 2020년 8월 31일
Hi,
I currently have a data set structured with 4 columns (C) and 15 rows (in this example). C1 and C2 are the categories in this case C1 = subject & C2 = task.
All 5 subjects performed 3 different tasks. and from that we recorded 2 variables C3,C4 are my variables of interest.
I would like to create a boxplot for C3, C4 using each of the 5 subject data points under the 3 categories in C2 ('Task1', 'Task2', 'Task3')
I currently can only either create individual figures for each task or get the plots to overlap each other and not display side by side.
The example data end result should be something like below.

답변 (1개)

Ayush Gupta
Ayush Gupta 2020년 8월 31일
This can be achieved using the hold on command along with the polyshape function in MATLAB. Suppose the vertices for task 1 are x1 = [C31 C32 C33 C34 C35] an y1= [C41 C42 C43 C44 C45]. Here C31 refers to the first value of C3 corresponding to Task1 and similarly for C41.
pgon1 = polyshape(x1,y1);
pgon2= polyshape(x2,y2);
plot(pgon) ;
hold on
plot(pgon2);
This can be continued for the next tasks and the desired plot can be obtained. For example, on how to use the polyshape functions and some examples on how to use it, refer the documentation.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by