Adding text from calculated functions and line of best fit to scatter plot

2 次查看(过去 30 天)
I have calculated three statistic values for observed vs simulated data. I want to add these defined output values (i.e. the cor_Manual_Urbano, bias_da_Manoel_Urbano, NASH_Manoel_Urbano) to the scatter plot of oberserved vs simulated. There is the additional problem that the output result for cor_Manual_Urbano produces a matrix but I only want to display the correlation value between the two variables. I also want to add a line of best fit to the scatter plot. Here is my code so far:
%pearsons%
cor_Manoel_Urbano = corrcoef(combined_data.Observed_Manoel_Urbano,combined_data.Simulated_Manoel_Urbano, 'Rows', 'pairwise')
%bias%
just_Manoel_Urbano = combined_data(:, [11,22]);
cleaned_Manoel_Urbano = rmmissing(just_Manoel_Urbano);
observedmean_Manoel_Urbano = mean(cleaned_Manoel_Urbano.Observed_Manoel_Urbano);
simulatedmean_Manoel_Urbano = mean(cleaned_Manoel_Urbano.Simulated_Manoel_Urbano);
bias_da_Manoel_Urbano = 100*((observedmean_Manoel_Urbano-simulatedmean_Manoel_Urbano)/observedmean_Manoel_Urbano)
%NASH%
DATA_NASH_Manoel_Urbano = [combined_data.Observed_Manoel_Urbano,combined_data.Simulated_Manoel_Urbano];
DATA_NASH_Manoel_Urbano(any(isnan(DATA_NASH_Manoel_Urbano), 2), :) = [];
NASH_Manoel_Urbano = NSE(DATA_NASH_Manoel_Urbano(:,1), DATA_NASH_Manoel_Urbano(:,2))
%scatter%
figure22 = figure('Name','Scatter Manoel Urbano','Color',[1 1 1]);
scatter(cleaned_Manoel_Urbano.Observed_Manoel_Urbano, cleaned_Manoel_Urbano.Simulated_Manoel_Urbano, 'k')
xlabel('Observed','FontName','Calibri','FontSize',12)
ylabel('Simulated', 'FontName','Calibri','FontSize',12)
title('Manoel Urbano','FontName','Calibri','FontSize',14);
set(gcf,'Position',[100 100 400 400])

采纳的回答

Star Strider
Star Strider 2021-3-26
To display the information on the plot, use the text function.
The sprintf or compose functions can also be helpful, depending on what you want to do.
  10 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by