フィルターのクリア

how to change the position of the axis data?

3 ビュー (過去 30 日間)
Pavel Kuzmitsky
Pavel Kuzmitsky 2022 年 11 月 8 日
編集済み: Jan 2022 年 11 月 8 日
how to change the position of the axis data? I want the numbers to be on the other side of the axis
something like this

採用された回答

Jan
Jan 2022 年 11 月 8 日
編集済み: Jan 2022 年 11 月 8 日
% Dummy contents:
H = axes;
plot(1:10);
drawnow;
% Get original ticks:
XTick = H.XTick;
XLabel = H.XTickLabel;
nTick = numel(XTick);
% Calculate modified positions, omit the marginal ticks:
YL = H.YLim;
Ypos = repmat(YL(1) + (YL(2) - YL(1)) / 40, 1, nTick - 2);
text(XTick(2:nTick-1), Ypos, XLabel(2:nTick-1), ...
'HorizontalAlignment', 'center', 'VerticalAlignment', 'bottom')
% Remove original tick labels:
H.XTickLabel = {};

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by