How to plot graph with annual x-axis?

조회 수: 3 (최근 30일)
Allan Silva
Allan Silva 2014년 10월 16일
댓글: Allan Silva 2014년 10월 16일
Please, I want to plot a graph with annual values on the x axis. Exemple, year=[1970 1971 1971 1971 1972 1972 1972 1973 1973 1973 1974 1974]; x=[-30.23 -3.21 -57.54 26.22 49.02 -19.91 -63.42 7.33 37.96 21.32 35.49 22.30];
plot(x); the graph is correct. but the x-axis ranges from 0 through 12.
plot(year,x); o grafico não perece correto.
what's wrong with using plot(x) and plot(year,x)? how to solve this problem?
Note: year=[1970 1971 1971 1971 1972 1972] month=[DEC JAN FEV DEC JAN FEV ...] seasonal values, the summer period.
Thank you for listening.

채택된 답변

Roger Wohlwend
Roger Wohlwend 2014년 10월 16일
plot(x)
c = 2 : 3 : 12;
set(gca,'XTick', c, 'XTickLabel', year(c))
  댓글 수: 1
Allan Silva
Allan Silva 2014년 10월 16일
Dear Roger... thanks for help. Helped me a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by