Adding scatter plots to main effects plot (DoE)

3 views (last 30 days)
Qayray
Qayray on 23 Jun 2019
Edited: Russell Senior on 28 May 2020
I am trying to add the data points used to generate the main effects plot to the plot as well.
%doe_full = xlsread('doe_full.xlsx','A2:AC22');
response_variables = {'...'}'; %this is a long cell, not part of the issue
for i_rv = 1 : length(response_variables)
[figh,axesh] = maineffectsplot(doe_full(:,8+i_rv), doe_full(:,6:8),'varnames',{'RPM', 'feed rate', 'air pressure'});
set(axesh,'FontSize',14);
set(axesh(1).XLabel,'FontSize',18)
set(axesh(1).YLabel,'FontSize',18)
set(axesh(2).XLabel,'FontSize',18)
set(axesh(3).XLabel,'FontSize',18)
subplot(1,3,2);
title(sprintf('Main effects of the predictor variables on %s',response_variables{i_rv}),'FontSize',18);
%{
for i_pv = 1 : 3
axesh(i_pv);
hold on;
scatter(doe_full(:,5+i_pv), doe_full(:,8+i_rv));
hold off;
end
%}
savefig(sprintf('data/doe_results/maineffects/%02d_%s.fig',i_rv,response_variables{i_rv}));
hold off
end
The code generates the main effects plots just like it's supposed to. However, adding the scatter plots using the commented out section is not working: I am attempting to use axesh(i_pv) to select the correct subplot and then add the data points using scatter(). However, only a few points are added and they do not appear to be using the existing x-axis.
What am I doing wrong?
  1 Comment
Russell Senior
Russell Senior on 28 May 2020
Edited: Russell Senior on 28 May 2020
One of the problems is that the x axes are not actual data. If you dig through the plot properties, the actual X data is [1,2,3... etc] If you look at the code for the plots, they are using tick labels to replace the 1,2,3... etc. with the data from your groups. So, to add data you will have to determine which x index your plot belongs too. So, if your x data is feed rate 10, the x data you put to your scatter plot is 3. Not very convenient for adding data, but there it is.

Sign in to comment.

Answers (0)

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!