add Summary statistics on a plot
21 ビュー (過去 30 日間)
古いコメントを表示
How can I add summary statistics on a plot? I have n plots and also I have separetly result of nash sutcliffe NSE and Mean Bias Error (MBE) matrix table (n*2). What I want to do is to put NSE and MBE reuslts on each plot outside the plot box.
figure(i)
legend
hold on
Qmax=1.2*(max(max(Q)));
s=length(Q);
plot(Q(w:end,1),'k','LineWidth',2.25);plot(Q(w:end,2),'b','LineWidth',2.25);
axis([1 s 0 Qmax])
legend(['Qobs', num2str(i)],['Qsim', num2str(i)],-1);
xlabel('time [days]')
ylabel('daily discharge [m^3/s]')
title([stations(i,3),stations(i,1)]);
text(s,Qmax,['NSE = ',num2str(NSE(i))])
text(s,Qmax,['MBE = ',num2str(MBE(i))])
0 件のコメント
採用された回答
Geoff Hayes
2014 年 10 月 6 日
csoki - it sounds like you want to just add the statistics outside of the axes that contains your plot. You can try the following, which creates two subplots within your figure - the one on the left for the plot, and the one on the right for the statistics.
figure;
x=-2*pi:0.0001:2*pi; % dummy x data
y=sin(x); % dummy y data
% create the subplot for the plot, and plot the data
h1=subplot('Position',[0.1,0.1,0.7,0.8])
plot(h1,x,y);
% create the subplot for the statistics
h2=subplot('Position',[0.85,0.1,0.05,0.8]);
% hide the axes and ticks
set(h2,'Visible','off');
% add the statistics
text(0,0.4,'NSE=1234','Parent',h2);
text(0,0.6,'MBE=5678','Parent',h2);
The left axes plots the data, and is is positioned such that it's bottom left corner is at (0.1,0.1) and has a width of 0.7 and a height of 0.8.
The right axes is positioned to the right of the previous one, with it's bottom left corner at (0.85,0.1) and has a width of 0.05 and a height of 0.8. We then hide the axes, and add the two statistics roughly in the middle of that (hidden) axes.
0 件のコメント
その他の回答 (1 件)
Sean de Wolski
2014 年 10 月 6 日
編集済み: Sean de Wolski
2014 年 10 月 6 日
You can use the interactive "Data Statistics" option to add stats to the plot:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!