Plotting lines between data points on a graph - PROBLEM!
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
im facing a problem of plotting a line between points plotted on a graph. below is my code. only points appear but not the line connected them. Why is this so? This code is within a FOR loop, is that why it doesnt work?
if ((cx>=10)&(cx<=60)&(cy>=10)&(cy<=60))
figure(2);
title('Graphical Results');
hold on;
plot(j, diameter(j), 'ro-', 'LineWidth', 2, 'MarkerEdgeColor', 'k', 'MarkerFaceColor', 'g', 'MarkerSize', 10)
ylabel('Diameter of pupil');
xlabel('Frame');
hold off;
set(gcf, 'Position', get(0, 'ScreenSize'));
fprintf(1,'#%3d %11.1f %8.1f\n', j, diameter(j), area);
end
below is the graph i am getting...
you realised there isnt a line connected it.. i have tried many combinations but nothing works.
0 Kommentare
Antworten (1)
Walter Roberson
am 6 Mär. 2012
Unless you supply at least two X and two Y coordinates to plot(), all it can do is draw the one point you give it.
You would be better off storing the j values until the end of the loop, and then
plot(Jlist, diameter(Jlist), 'ro-' <etc>)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!