xticks not working with logscale axis
Afficher commentaires plus anciens
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')
Réponses (1)
Seiji Engelkemier
le 21 Juil 2021
0 votes
Catégories
En savoir plus sur Grid Lines, Tick Values, and Labels dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!