A simple/efficient way to add one additional xtick, and the corresponding xticklabel, to the existing xticks and xticklabels

조회 수: 5 (최근 30일)
What is a simple/efficient way to add one additional xtick, and the corresponding xticklabel, to the existing xticks and xticklabels (that are automatically displayed by matlab)?
For example, in the following x-axis, I would like to add the xtick "x=5" and the corresponding xticklabel "5":
plot(1:50)

채택된 답변

Voss
Voss 2024년 8월 30일
편집: Voss 2024년 8월 30일
plot(1:50)
new_tick = 5;
ax = gca();
ax.XTick = unique([ax.XTick new_tick]);

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by