Hello everyone,
I would like to plot a graph vs the month names ('Jan' 'Feb' ... 'Dec'). I have in fact the solar power generation for a year in a vector (length = 5525600) and I tried with this:
h=plot(solar)
set(get(h,'Parent'),'XTickLabel',{'Jan' 'Feb' 'Mar' 'Apr''May' 'Jun' 'Jul' 'Aug' 'Sept' 'Oct' 'Nov' 'Dec'})
The problem is that all the months are not shown below the x axis. It stops at 'Jul'. Can someone help me with this please?
Thank you

Antworten (1)

dpb
dpb am 12 Aug. 2015

0 Stimmen

Convert the times to date numbers and plot against them (or compute from the sampling time the locations in the vector that are the beginning of month indices).
If use the former, then use datetick to format the axes labels as times and set the tick marks to the first day of the month (using the date number).
The reason the labels written above stopped at July is that there were seven tick marks by default; you have to set the number of ticks to the number that you want labels for and at those values, either in date numbers if use it or as indices into a linear array if that's the way you plot.

Kategorien

Mehr zu Polar Plots finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 12 Aug. 2015

Beantwortet:

dpb
am 12 Aug. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by