필터 지우기
필터 지우기

Plotting table results from grpstats

조회 수: 5 (최근 30일)
Sophia
Sophia 2023년 5월 10일
댓글: Sophia 2023년 5월 10일
I would like to display grpstats for all three variables of FVFM, YIELD and NSV, DataVars only allows me to do this for one variable
Is it possible to plot select results from the table and display as an error bar plot (mean and std), for example just the results for 0_0, 4_0 and 6_0? I want to make a tiled plot that separates the results by treatment which is why I dont want to plot all the results at once
filename = 'PAM1'
PAM1 = readtable (filename)
PAM1stats = grpstats(PAM1,["DHW","SHADE"],["min","max","mean","std"], "DataVars","FVFM") %ONLY ONE VARIABLE AT ONCE

채택된 답변

Antoni Garcia-Herreros
Antoni Garcia-Herreros 2023년 5월 10일
Hello Sophia,
You could try something like this:
close all
load('PAM1.mat')
PAM1stats = grpstats(PAM1,["DHW","SHADE"],["min","max","mean","std"], "DataVars","FVFM"); %ONLY ONE VARIABLE AT ONCE
Data2Plot=PAM1stats{[1 4 7],6:7}; % Select the data you want to plot. In this case 0_0 , 4_0 and 6_0
p=plot([1,2,3],Data2Plot(:,1)','o','LineWidth',2,'MarkerFaceColor','k','MarkerEdgeColor','k');
hold on
e=errorbar([1,2,3],Data2Plot(:,1),-Data2Plot(:,2),Data2Plot(:,2),'LineWidth',1.5,'LineStyle','none','Color','k');
e(1).CapSize=18;
ax=gca;
ax.XLim=[0.5 3.5];
ax.XTick=[1 2 3];
ax.XTickLabel={'0-0';'4-0';'6-0'};
ax.FontName='Arial';
ax.FontSize=13;
ax.FontWeight='bold';
ax.TickDir='out';
ax.Box='off';
  댓글 수: 3
Antoni Garcia-Herreros
Antoni Garcia-Herreros 2023년 5월 10일
Try
PAM1stats = grpstats(PAM1,["DHW","SHADE"],["min","max","mean","std"], "DataVars",{'FVFM','YIELD','NSV'});
Sophia
Sophia 2023년 5월 10일
Perfect, just needed square brackets. Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by