How to save a plot with multiple overlays as a single variable and/or plot the regression for all points as one line?

1 view (last 30 days)
I have multiple samples in each graph that i have overlahyed using the hold on function, i am looking to find the regression for all points on the final overlayed scatter plot!
hold off
t = tiledlayout(1,2)
ax1 = nexttile
%Cre+
hold on
scatter(t1.D,t1.CC)
scatter(t6.D,t6.CC)
scatter(t8.D,t8.CC)
scatter(t9.D,t9.CC)
scatter(t12.D,t12.CC)
xlim([0 1000])
ylim([250 6000])
title('Cre-')
ylabel('Area(pixels^2)')
xlabel('Distance from nearest Sinus edge (pixels x 10^3)');
ax2 = nexttile
% Cre-
hold on
scatter(t4.D,t4.CC)
scatter(t5.D,t5.CC)
scatter(t10.D,t10.CC)
scatter(t11.D,t11.CC)
scatter(t13.D,t13.CC)
xlim([0 1000])
ylim([250 6000])
title('Cre-')
ylabel('Area(pixels^2)')
xlabel('Distance from nearest Sinus edge (pixels x 10^3)');
Thanks!

Answers (1)

KSSV
KSSV on 22 Jul 2021
Read about function regression to get the regression value and read about plotregression to get the regression plot.

Community Treasure Hunt

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

Start Hunting!