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 Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by