Plotting lines between data points on a graph - PROBLEM!
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Walter Roberson
le 6 Mar 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 commentaires
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!