how to change the X-axis unit interval

9 views (last 30 days)
Hello Everyone,
Does anyone know how to adjust only the Axis interval/unit, without changing the outcome (dataset) of the graph.
I have a dataset of X and Y in 15-Min interval of a half year (each approx 17500 arrays). I wish to show the X-axis in hourly interval and Y-Axis in 15 minutes interval as it is. If I carry out changes to adjust the graph in a hourly interval (approx 4400 arrays) by taking the mean value, i would be missing out the max or min value of 15 min Interval, and thus not get the same curve as displayed below. I wish keep the graph curve as it is and change only the X-axis units from 15 min (0, 2000, 4000, ..... 18000) to hourly (0.500, 1000, ... 4500).

Accepted Answer

Eunan McShane
Eunan McShane on 17 Jan 2020
Hey,
This might not be the cleanest solution however you can manually change the xtick labels whilst keeping them in the same location as before
Use xticks([0 2000 4000...])
and xticklabels({'0.5','1000','x'...})
If I am understanding correctly this should be a quick fix for the plot, hopefully that helps
Cheers

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!