I want to include a vertical line on the histogram, so it shows the location of the mean. The mean value is 5.12, how can I modify this code?
조회 수: 88 (최근 30일)
이전 댓글 표시
subplot(2,1,1)
histogram(LotH);
grid on;
title("Graph of (LotH)");
xlabel("LotH");
ylabel("Scores");
hold on;
line([0,5.12], ylim, 'LineWidth', 2, 'Color', 'r');
댓글 수: 1
Walter Roberson
2020년 10월 29일
xline() starting from R2018b https://www.mathworks.com/help/matlab/ref/xline.html
답변 (1개)
Rik
2020년 10월 28일
You are not plotting a vertical line. The coordinates you're using are (0,y_min) and (5.13,y_max), which is not a vertical line. You need to use this:
line(5.12*[1 1],ylim)
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!