Trying to add horizontal line on a graph
조회 수: 1 (최근 30일)
이전 댓글 표시
So im trying to add a horizontal line to to show the mean gradient to the graph on the bottom.
The mean is -0.0714 and i want to draw this line as a dotted line. iv tried all sorts of things on this forum but cant seem to get it
Thanks in advance
댓글 수: 0
답변 (1개)
Walter Roberson
2016년 11월 8일
XL = xlim();
plot( XL, [TheMean, TheMean])
댓글 수: 2
Walter Roberson
2016년 11월 8일
Example:
plot(x,y)
x = 1:30;
y = sin(x)+x;
TheMean = mean(y);
plot(x,y)
hold on
XL = xlim();
plot(XL, [TheMean TheMean], 'g--')
hold off
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!