Adding scatter plots to main effects plot (DoE)

조회 수: 4 (최근 30일)
Qayray
Qayray 2019년 6월 23일
편집: Russell Senior 2020년 5월 28일
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
Russell Senior
Russell Senior 2020년 5월 28일
편집: Russell Senior 2020년 5월 28일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by