Plotting table results from grpstats
5 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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
2023-5-10
Try
PAM1stats = grpstats(PAM1,["DHW","SHADE"],["min","max","mean","std"], "DataVars",{'FVFM','YIELD','NSV'});
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Errorbars 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!