Effacer les filtres
Effacer les filtres

How to let y-axis ticks increase by 2?

1 vue (au cours des 30 derniers jours)
AbelM Kusemererwa
AbelM Kusemererwa le 23 Juil 2015
How to let y-axis ticks increase by 2? The number on the y-axis should also be in 2 decimal places. What codes will I use?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 23 Juil 2015
Look at this
t=0:0.001:10;
y=12.5*sin(t)
plot(t,y)
yt=get(gca,'ylim')
nyt=yt(1):2:yt(2)
ytl=cellfun(@(x) sprintf('%.2f',x),num2cell(nyt),'un',0)
set(gca,'ytick',nyt,'yticklabel',ytl)

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by