I'm writing my Rsquared values onto a scatter plot but they don't appear on the correct suplot!
Show older comments
I've managed to print my Rsquared values onto scatter subplots but for some reason it's shifted each value onto the wrong graph by one. I have 8 graphs and the last graph for some reason doesn't get an Rsquared value printed on it!
My code for this part is:
for j = 2:9 %change 9 to 8 when removing one KPI
y = T{:,j};
R = corrcoef(x,y);
R_squared = R(2)^2;
text(5, 5, ['R^2 =' num2str(R_squared)]);
ax = subplot(2,4,(j-1));
scatter(ax,x,y,'filled');
lsline(ax);
ylim([0,max(y+10)]);
xlim([0,8]);
xlabel('League Score');
ylabel(T.Properties.VariableNames{(j)});
end;
So obviously the text part is what prints the rsquared values to my graphs.
Thank you!!
Accepted Answer
More Answers (0)
Categories
Find more on Discrete Data 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!