Filter löschen
Filter löschen

Plotting table results from grpstats

4 Ansichten (letzte 30 Tage)
Sophia
Sophia am 10 Mai 2023
Kommentiert: Sophia am 10 Mai 2023
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

Akzeptierte Antwort

Antoni Garcia-Herreros
Antoni Garcia-Herreros am 10 Mai 2023
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 Kommentare
Antoni Garcia-Herreros
Antoni Garcia-Herreros am 10 Mai 2023
Try
PAM1stats = grpstats(PAM1,["DHW","SHADE"],["min","max","mean","std"], "DataVars",{'FVFM','YIELD','NSV'});
Sophia
Sophia am 10 Mai 2023
Perfect, just needed square brackets. Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by