get the values of the axis of a plot
조회 수: 97 (최근 30일)
이전 댓글 표시
I have created a plot and I want to know if there is a command to get the value of the x axis of the plot because I want to draw an horizontal line just as long as the x axis
thanks
댓글 수: 0
채택된 답변
Star Strider
2017년 3월 9일
You can get the limits of the x-axis with:
XL = get(gca, 'XLim');
To plot a horizontal line the length of the x-axis:
plot(XL, [1 1]*val)
where ‘val’ is the y-value of the line.
You can get the values of the x-ticks with:
XT = get(gca, 'XTick');
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!