is it possible to format the x-axis so that it goes from high to low to high?

3 views (last 30 days)
I am trying to graph a Utah water year which starts on Oct 1 one year and ends Oct 1 the next. I have changed the date strings to numbers and then changed the datenumbers to a day of year. Then I changed the day of year to a fractional year, meaning oct. 1 is about .8, jan 1 is 0.0 and June is about 0.5. I want the x-axis to start @ Oct 1 (0.8) and end at 0.8, so 0.0 (Jan.1) is in the middle. Anyone know how I would approach this?

Answers (1)

Walter Roberson
Walter Roberson on 26 Apr 2013
Does the axis itself need to be like that? If it does you are going to need multiple axes. For example if you need data brushing to be able to work on it, then you have a problem. If you need zoom and pan to be able to work on it, or datacursor, then it gets messy but could be fudged.
If it is only a matter of the axis label, then you can set xticklabel to display different things. For example,
curxtick = get(gca, 'XTick');
set( 'xticklabel', cellstr(num2str(mod(curxtick(:),1))) );

Tags

Community Treasure Hunt

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

Start Hunting!