Translation of a plot line
조회 수: 4 (최근 30일)
이전 댓글 표시
Considering an existing figure, would it be possible to vertically translate one of the lines of the plot by a certain amount?
댓글 수: 0
채택된 답변
Walter Roberson
2021년 4월 20일
The easiest way is to find the line handle, extract the YData, add the shift to it, and store the result back in the YData property.
댓글 수: 2
Walter Roberson
2021년 4월 20일
plot(rand(1,50));
h = findobj(gcf, 'type', 'line');
h.YData = h.YData + 5;
Notice that rand() is strictly in the range 0 to 1, but the plot output is in the range 5 to 6, because the line has been moved up by 5
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!