Joining points from a scatter plot with a single line

Hi I have a code which collects data from different files and loads them as scatter points on one graph. I am looking to join these point together but as the data source is different for each point I am struggling. Below is the code that creates the scatter plot is there anything that can be added to join the points?
dinfo = dir();
dinfo(~[dinfo.isdir]) = []; %zap non-directories
dinfo( ismember({dinfo.name}, {'.', '..'}) ) = []; %zap . and ..
nfold = length(dinfo);
vars = cell(nfold,1);
folders = {dinfo.name};
for K = 1 : nfold
thisdir = folders{K};
vars{K} = load( fullfile(thisdir, 'CR_vs_NF.mat'), 'Contact', 'O' );
plothandles(K) = plot(vars{K}.O, vars{K}.Contact, 'x');
hold all
end
legend(plothandles, folders);
ylabel('Contact Ratio');
xlabel('Jumping frequency/Beam Natural frequency');
savefig('Cr_vs_NF.fig');
clear;

댓글 수: 3

I would create a 2-column matrix from both ‘vars{K}.O’ and ‘vars{K}.Contact’ in the loop, then sort them using sortrows by column 1. Then plot the sorted matrix.
You forgot to attach CR_vs_NF.mat, or even a screenshot of what plot you have so far. Attach a PNG screenshot ( NOT a .fig file) with the picture icon:
Are you simply looking to have a double for loop to plot a line between every point and every other point?

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

답변 (1개)

KSSV
KSSV 2017년 3월 27일

0 개 추천

댓글 수: 1

Unfortunately, this link you have provided is not helpful to this question. He has different groups of data points and would like them connected via lines at a later time.
The link provided assists in helping with ONE data series.

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

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

질문:

2017년 3월 25일

댓글:

2018년 2월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by