xticks not working with logscale axis

12 ビュー (過去 30 日間)
Seiji Engelkemier
Seiji Engelkemier 2021 年 7 月 21 日
回答済み: Seiji Engelkemier 2021 年 7 月 21 日
I'd like to show a log scale number line with some non-overlapping rectangles spanning the line. I'm having issues with showing only a subset of tick marks of the xlim range that I set. Despite specifying the xticks, all the ticks are shown (as would be if 'auto' was used). There's no issue if the xscale is linear, so I'm wondering if this is a bug.
Probably not relevant, I'm choosing to label only a few tick marks.
figure
% rectangle(...)
xlim([0.8 1100])
x_s = [(1:9)*10^0 (1:9)*10^1, (1:9)*10^2, 10^3]';
xticks(x_s)
x_labels = repmat({''},length(x_s),1);
x_labels([1, 10, 19, 28]) = num2cell([1 10 100 1000]);
xticklabels(x_labels)
set(gca, 'XScale','log')

回答 (1 件)

Seiji Engelkemier
Seiji Engelkemier 2021 年 7 月 21 日
Still curious if there's an answer, but I solved my problem by plotting a horizontal line, plotting vertical bars for tick marks, text() for the tick labels, and setting x-axis color to none.

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by