draw more date in the axis

조회 수: 1 (최근 30일)
shamal
shamal 2025년 1월 17일
댓글: shamal 2025년 1월 20일
I would like to report more dates: for example every month or every week
I use plot to draw it..(
plot(Ax_Sys,XDates(locs(:,i)),sig,'DisplayName',STR_name{i},'Color',SumCTR_color(i,:),'LineWidth',1);)

채택된 답변

Walter Roberson
Walter Roberson 2025년 1월 20일
이동: Walter Roberson 2025년 1월 20일
load matlab_Xdates
load matlab_TeStrum
load matlab_fig
Ax_Eq.Parent
ans =
0x0 empty GraphicsPlaceholder array.
Somehow, you have an axes that has no Parent, so gca is creating a new axes, and that new axes defaults to numeric.
You should also be specific about the axes to parent graphics operations to.
legend_lines(1)=plot(Ax_Eq,XDates,TE_strum(:,1));
xtickformat(Ax_Eq, 'MMM u' );% DA SISTEMARE
xticks(Ax_Eq, XDates(1):calmonths(1):XDates(end));% DA SISTEMARE
  댓글 수: 3
Walter Roberson
Walter Roberson 2025년 1월 20일
The last line,
___ = xticks(ax,___)
is indicating that you can pass an axes as the first parameter.
shamal
shamal 2025년 1월 20일
okk thank

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2025년 1월 17일
Use xticks
If you must report every week, then you will probably want to use xtickangle
  댓글 수: 9
Cris LaPierre
Cris LaPierre 2025년 1월 20일
편집: Cris LaPierre 2025년 1월 20일
I can't duplicate your error, and I show an example that works with the expected data.
Please share all the data used to create your figure. Consider saving your variables to a mat file and attaching it to your post using the paperclip icon. Since you are specifiying a target axis, it would be insightful to see all relevant code.
shamal
shamal 2025년 1월 20일
편집: shamal 2025년 1월 20일
Ok i try to send it
legend_lines(1)=plot(Ax_Eq,XDates,TE_strum(:,1));
xtickformat( 'MMM u' );% DA SISTEMARE
xticks(XDates(1):calmonths(1):XDates(end));% DA SISTEMARE
Error using xtickformat (line 34)
Invalid numeric tick label format.
Error in untitled2 (line 7)
xtickformat( 'MMM u' );

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

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by