Clear Filters
Clear Filters

add Summary statistics on a plot

12 views (last 30 days)
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.
hold on
axis([1 s 0 Qmax])
legend(['Qobs', num2str(i)],['Qsim', num2str(i)],-1);
xlabel('time [days]')
ylabel('daily discharge [m^3/s]')
text(s,Qmax,['NSE = ',num2str(NSE(i))])
text(s,Qmax,['MBE = ',num2str(MBE(i))])

Accepted Answer

Geoff Hayes
Geoff Hayes on 6 Oct 2014
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.
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
% create the subplot for the statistics
% hide the axes and ticks
% add the statistics
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.

More Answers (1)

Sean de Wolski
Sean de Wolski on 6 Oct 2014
Edited: Sean de Wolski on 6 Oct 2014
You can use the interactive "Data Statistics" option to add stats to the plot:


Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!