How to draw lines in matlab figure
Afficher commentaires plus anciens
Hi everyone, I plot simple figure in matlab by using plot(x,y).now I need to draw verticale dashed lines like grid lines at some specific points on x-axis.,what should I do? thanks
Réponse acceptée
Plus de réponses (1)
Steven Lord
le 11 Nov 2019
You could either turn the grid on or use the xline and/or yline functions.
plot(1:10);
grid on
xline(4.5, 'r:')
yline(2*pi, 'c--', 'LineWidth', 2)
With xline and yline, if you pan or zoom the axes the lines still extend to the limits of the axes.
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!