Filter löschen
Filter löschen

How to plot X axis for 31 years from 1981 to 2014?

1 Ansicht (letzte 30 Tage)
reyadh Albarakat
reyadh Albarakat am 17 Apr. 2015
Beantwortet: Star Strider am 17 Apr. 2015
Hi guys, I am beginner in Matlab I want to plot x axis for years starts from 1982-2014 and I have missing data in (1994) and (2000). when I do the plot function X axis shows division for each 5 years(1980,1985,1990........2015); How can I make X axis to show division each year ( 1982,1983,1984,1985........2014)?
Thank you
Reyadh

Antworten (1)

Star Strider
Star Strider am 17 Apr. 2015
Guessing here, but this should probably work:
x = [1982:1993 1995:1999 2001:2014];
y = randi(10, 1, 31);
figure(1)
plot(x, y)
set(gca, 'XLim', [1982 2014])
set(gca, 'XTick', [1982:2014], 'FontSize',8)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by