필터 지우기
필터 지우기

add vertical lines using xline

조회 수: 10 (최근 30일)
Ilias Minas
Ilias Minas 2022년 2월 25일
댓글: Walter Roberson 2022년 2월 25일
Hi,
I have the following graphs. There are 2 graphs in 1 figure and in x axis are date and times.
I would like to add vertical lines using the command xline but i cannot find how to use it in date and times.
E.g. I want to add a vertical line at 20/01 7.00am
Thank you

채택된 답변

Star Strider
Star Strider 2022년 2월 25일
It would helpo to understand what the dates are in the posted code.
figure
xline(datetime('20/01 7:00am', 'InputFormat','dd/MM hh:mma'))
The 'InputFormat' string may need to be changed to ocnform with the units on the x-axis.
.
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 2월 25일
Note: if you are still using serial date numbers together with datetick() then the approach shown here will not work: you would need to pass a serial data number to xline() for that case.
Likewise if you are passing in year + fraction of a year to plot() then the approach shown here will not work: you will need to pass the appropriate year + fraction of a year to xline() in that case.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by