Azzera filtri
Azzera filtri

How do I change the values ​​of the axes?

2 visualizzazioni (ultimi 30 giorni)
Hi I have this plot:
figure; errorbar(y,e,'-o')
legend('Cist -9dB', 'Cist -6dB', 'Cist -3dB', 'Cist 3dB', 'Cist 6dB', 'Cist 9dB');
xlabel('Gain');
ylabel('Grey Levels');
title('Dynamic range of 20dB');
The x axis start from 0 to 21, because I have 21 one point, how can I make the axis start from -20dB to 20dB (every 2 dB, To correspond to the first point -20dB, to the second -18 and so on: at each point increase of 2 dB up to +20)

Risposta accettata

Star Strider
Star Strider il 11 Ott 2021
Try something like this —
x = linspace(0, 21, 25);
y = rand(size(x));
figure
plot(x, y)
xt = get(gca, 'XTick');
xtv = linspace(min(xt), max(xt), 21);
set(gca, 'XTick',xtv, 'XTickLabel',compose('%3d dB',-20:2:20))
Make appropriate changes to get the result you want.
.

Più risposte (0)

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by