How to plot a line on the histogram?

조회 수: 46 (최근 30일)
yogan sganzerla
yogan sganzerla 2017년 6월 7일
답변: RBEngineer 2020년 4월 27일
Hello,
My name is Yogan and I am studying Monte Carlos Method. I plotted the graphic using "Hist(Name_Variable)"
I am adding above the gráphic that I am talking.
Well, My question is: I need to draw a vertical line in a specific point . I found a lot of answers about draw lines using the Plot, but it dosen't happend with Hist.
Thanks

채택된 답변

Image Analyst
Image Analyst 2017년 6월 7일
편집: Image Analyst 2017년 6월 7일
Use line
hold on;
line([x, x], ylim, 'LineWidth', 2, 'Color', 'r');
where x is the value you want the vertical line drawn at, for example 700:
line([700, 700], ylim, 'LineWidth', 2, 'Color', 'r');

추가 답변 (1개)

RBEngineer
RBEngineer 2020년 4월 27일
From 2018b you can use:
xline(x_position);

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by