I have a question about plots and subplots. I am iterating over some data and I am trying to get everything into a plot. It worked that every plot got written into one plot with hold on and figure but now I have to fit in regression lines. Therefore I want to plot everythiong into one figure but into different plots. This doesnt work as my plot looks a little bit weird.

My problem now is, that I cant find real helpful things on how to manage those plots other than using uicontrol. But I have never ever used uicontrol and I can´t find enogh documentation to use it properly. I found this code:
figure(1)
panel1 = uipanel('Parent',1);
panel2 = uipanel('Parent',panel1);
set(panel1,'Position',[0 0 .99 1]);
set(panel2,'Position',[-1 0 2 1]);
set(gca,'Parent',panel2);
h = image; % <- Code for my own image goes here
s = uicontrol('Style','Slider','Parent',1,...
'Units','normalized','Position',[0 0 1 .025],...
'Value',1,'Callback',{@slider_callback1,panel2});
but all I get is a callback Problem. I dont know how to switch from a horizontal to a vertikal scrollbar and how to get my plots in there. The code manage it to write into the figure but in a very strange way that results in a similiar way as the subplotting everything.
I hope you can help me as good as always!
PS: This is my current code thats working (picture of the plot after it)
%% Clear Workspace
clc, clear all, close all; %
S = {} ;
F = [] ;
figure, hold on ;
%% Specify working directory
myFolder = '/home/k/karkarov92/Documents/Daten Igor/Zwick';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isfolder(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s\nPlease specify a new folder.', myFolder);
uiwait(warndlg(errorMessage));
myFolder = uigetdir(); % Ask for a new one.
if myFolder == 0
% User clicked Cancel
return;
end
end
%% Start Import from Mathilda aka. Z20
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.TXT'); % Change to whatever pattern needed.
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
str = baseFileName;
level = wildcardPattern + "NIE_TOM_1_" ; % Name of the Pattern before the Name of the Sample
pat = asManyOfPattern(level);
str = extractAfter(str,pat);
Sample = erase(str,".TXT");
disp(Sample)
delimiterIn = ' '; %Extract thickness out of headers
headerlinesIn = 9;
G = importdata(fullFileName,delimiterIn,headerlinesIn);
G(3);
H = split(G(3));
K = H(2);
thickness = str2double(K)/100 ;
%read Table and extract Units
A = readtable(fullFileName,'decimal', ','); % without decimal and "," data import not with the right value wrong unit
Units = A(1,:);
A(1,:) = []; %units extracted and then stripped from table
%table = A(1:4,:); table output test
B = table2array(A); %change data from table to array
%disp(B(1:4,:)) ; %Array output test
strain = (B(:,2)- B(1,2)) / B(1,2); %strain calculated and stored in vector strain
stretch = strain +1 ; %stretch calculated and stored in vector strain
crossSection = 5. * thickness ; %calculate cauchy stress and cross section
cauchyStress = ((B(1:end,3).*stretch) / crossSection ) * 1000 ; %[GPa]
M = max(B) ; %exctract maxForce
maxForce = M(1,3) ;
F(end+1) = maxForce ;
S{k} = Sample ;
plot(stretch,cauchyStress)
xlabel('Stretch')
ylabel('Cauchy Stress')
title('Linear Regression for Modulus')
grid on
end
