如何在matlab中绘制单个垂直线?

问题描述 投票:-2回答:2
theta = linspace(0,2*pi,200); y = theta;x = 10;plot(x,y,'o');

当我写这个我得到点但是当我用图(x,y)替换图(x,y,'o')时,我应该在x = 4处得到一条垂直线,但图形变空了。

matlab plot
2个回答
2
投票

你可以使用stem

x = 10;
y = 200;
stem(x,y,'Marker','none');

stem plot


1
投票

从这个回答:https://it.mathworks.com/matlabcentral/answers/2031-adding-vertical-line-to-plot

fig=figure; 
hax=axes; 
x=0:0.1:10; 
hold on 
plot(x,sin(x)) 
SP=1; %your point goes here 
line([SP SP],get(hax,'YLim'),'Color',[1 0 0])
© www.soinside.com 2019 - 2024. All rights reserved.