How to draw lines in matlab figure
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (1)
Steven Lord
il 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.
Categorie
Scopri di più su Line Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!