Plot vertical lines in a figure with a certain distance

2 visualizaciones (últimos 30 días)
AA
AA el 14 de Oct. de 2017
Editada: AA el 26 de Oct. de 2017
Hi, I would like to plot vertical dotted lines on a figure. These should be placed after every 60 units on the x axis.

Respuesta aceptada

Star Strider
Star Strider el 14 de Oct. de 2017
Try this:
x = linspace(0,1, 250); % Create Data
y = 5+randn(size(x)); % Create Data
figure(1)
plot(x, y)
hold on
VLX = repmat(x(60:60:end), 2, 1); % Vertical Line ‘x’ Locations
VLY = repmat(ylim, size(VLX,2), 1)'; % Vertical Line ‘y’
plot(VLX, VLY, 'LineWidth', 1.5)
hold off

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by