How to change markers on axes to be on the opposite side and how to add more markers in between that are smaller
Afficher commentaires plus anciens
So here's my graph

I would like to flip the axis markers for each point to the opposite side and add more markers in between each point but that are smaller. How do I do this?
Réponses (2)
plot(rand(20,3))
h=gca;
h.XMinorTick = 'on';
h.TickDir = 'out';
2 commentaires
Christopher Arreola
le 10 Déc 2021
Chunru
le 10 Déc 2021
"doc gca" for more info. It means get current axes handle.
Star Strider
le 10 Déc 2021
Modifié(e) : Star Strider
le 10 Déc 2021
Try something like this —
x = logspace(-4, 5, 500);
y = 1-exp(-0.2*x) + sin(2*pi*x*1E-4)*0.1;
figure
semilogx(x, y)
Ax = gca; % gca = 'Get Current Axes' Handle
xt = log10(xticks);
N = 5; % X-Tick Frequency Multiplication Factor
xtn = linspace(min(xt), max(xt), numel(xt)*N);
lxtn = 10.^(xtn);
Ax.XTick = lxtn;
Ax.XTickLabel = round(log10(lxtn),1);
Ax.XDir = 'reverse';
EDIT — Added a short explanation of gca as a % comment. No other changes in the code.
.
Catégories
En savoir plus sur Discrete Data Plots 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!

