Below is pictured 3 sets of scatterplots, each with their own regresionline. The blue and red represent what I'm trying to achieve, currently the green get dot's at each datapoint of the line. If I change the order of plotting the graphs in the code, the "mistake" will jump to whatever graph is the third one plotted.
I've removed all the graphs plotted on the right axis and located the error to occour in the "yyaxis left" command, if I remove this, everything is plotted as intended. I've tried dictating the style by "LineStyle","-" with no result.
Can anyone provide me with a method of overcoming this issue
Below is supplied the skeleton program. (Un)comment "yyaxis left" to toggle the error on/off.
X_samples=(0.75:0.75:4.25); % Create x_axis for samples
x_axis = 0.75:0.03:4.5; % Create x-axis for plotting
% Sample 1
sample1_raw=[0.386 0.596 0.728 0.801 0.835]; % 5 Samples
sample1 = polyfit(X_samples,sample1_raw,4); sample1_reg = polyval(sample1,x_axis);% Sample2
sample2_raw=[0.7918 0.8638 0.8786 0.877 0.8689]; % 5 Samplessample2 = polyfit(X_samples,sample2_raw,4);sample2_reg = polyval(sample2,x_axis);% slip
sample3_raw=[0.066 0.1407 0.208 0.28 0.368]; % 5 Samplessample3 = polyfit(X_samples,sample3_raw,4);sample3_reg = polyval(sample3,x_axis);% plotting
figure('Name','Samples')yyaxis lefthold onxlim([0.6 4.5])ylim([0 1])plot(x_axis,sample2_reg,'color','b',"LineStyle","-")scatter(X_samples,sample2_raw,'b')plot(x_axis,sample3_reg,'color','r',"LineStyle","-")scatter(X_samples,sample3_raw,'r')plot(x_axis,sample1_reg,'color','g',"LineStyle","-")scatter(X_samples,sample1_raw,'g')
Best Answer