Joining points of a plot
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Waqas Syed
el 16 de Sept. de 2015
Editada: Kirby Fears
el 16 de Sept. de 2015
Hi,
I am plotting a graph shown in the images using the following code. Kindly let me know how I should change it to join these points using straight lines. Also how can I give a particular label to that line? Ultimately I would be having multiple parallel lines like this with different labels. Thanks.
h1=figure; figure(h1); hold on;
for n=1:length(zeta_dom_r) if abs(zeta_dom_r(n)-0.700)<0.0001
plot(tau_invp(n), T_delayp(n), 'r.')
xlabel('\tau (s)');
ylabel('T Delay (s)');
xlim([0 5]);
ylim([0 0.5]);
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149138/image.jpeg)
end
0 comentarios
Respuesta aceptada
Kirby Fears
el 16 de Sept. de 2015
Editada: Kirby Fears
el 16 de Sept. de 2015
Just add a dash to the line specification to connect the dots.
Instead of
plot(tau_invp(n), T_delayp(n), 'r.')
Add a dash as shown below
plot(tau_invp(n), T_delayp(n), 'r.-')
After plotting, use the legend function to add a legend to your graph. Just input names for each line in the order in which they were plotted and they will appear in the legend.
plot(1:10, rand(1,10), 'r.-')
legend('myline')
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!