필터 지우기
필터 지우기

Issue with XTicks and XTickLabels in App Designer

조회 수: 20 (최근 30일)
Hawki005
Hawki005 2019년 5월 1일
답변: Adam Danz 2019년 5월 1일
I have a plot in app designer that uses a UI Axis. The data goes to 32 hours but I would like to limit the x axis (Time in hours) range to 24 hours and then label the XTicks every 4 hours. However, with the XLim working to limit to 24 hours, the distance between Ticks is still 5 hours, but with the correct Tick Labels. Am I missing something?
Capture.JPG
This is my axis manipulation code:
app.UIAxes2.XAxisLocation = 'origin';
app.UIAxes2.YAxisLocation = 'origin';
app.UIAxes2.XMinorGrid = 'on';
app.UIAxes2.YMinorGrid = 'on';
app.UIAxes2.XGrid = 'on';
app.UIAxes2.YGrid = 'on';
app.UIAxes2.XLimMode = 'manual';
app.UIAxes2.XLim = [0 24];
app.UIAxes2.XTickMode = 'manual';
app.UIAxes2.XTick = ([0 4 8 12 16 20 24]);
app.UIAxes2.XTickLabelMode = 'manual';
app.UIAxes2.XTickLabel = [0 4 8 12 16 20 24];
app.UIAxes2.YLimMode = 'auto';
app.UIAxes2.YTickMode = 'auto';

채택된 답변

Adam Danz
Adam Danz 2019년 5월 1일
Your code is fine. I think you're assuming the tick interval is 5 hours because there are 5 minor grid lines in each interval. If that's the case, you shouldn't assume the minor ticks are at 1-hr intervals.
Below is an example in the documentation where the minor grids contain 5 segments between ticks. To be certain that your ticks are correct, plot some data at known coordinates and make sure they align with your ticks.
plot(4,1,'r*') % on tick x=4
190501 091200-DisplayMajorMinorGridLinesExample_01.png (560×420).jpg

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by