How to specify an x-range for a yline?
51 次查看(过去 30 天)
显示 更早的评论
In the documentation link: https://se.mathworks.com/help/matlab/ref/yline.html#mw_fe7a36af-ea48-44bc-8536-26d21d107674
we have the following code;
x = -2:0.25:2;
[X,Y] = meshgrid(x);
Z = X.*exp(-X.^2-Y.^2);
contour(X,Y,Z,30)
yl = yline(0,'--','y = 0','LineWidth',3);
It returns the following graph:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/557927/image.png)
How to specify a range for the line? for example if i want to see the line only between x=-1 to x=1?
0 个评论
采纳的回答
Walter Roberson
2021-3-22
You cannot do that with yline() . You need to line() or plot() the line into place, and text() the label into place.
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!