How to modify a time series plot
7 次查看(过去 30 天)
显示 更早的评论
I have created a time series plot. My x axis shows the dates that correspond with each point as intended, however, it is only showing four dates. For this particular data file, there are 17 dates. Is there a way to change the way the date values show up?
0 个评论
采纳的回答
dpb
2018-8-15
You can set the tick locations and formatting as desired; you'll may have to rotate to get enough room for as much as you're wanting to show to be legible; dates/times take up a lot of real estate.
2 个评论
dpb
2018-8-15
Well, approximately log-distributed times on a datetime axes seems a little unusual...bet nobody at TMW ever thought of somebody having data that looked like that! :)
What you need to do is to set the XTick values to a set across the axes limits instead of using every observed value -- ticks and data points don't have to coincide.
Try something like (air code, don't have your data to play with but should work I believe)
xtk=xlim; % retrieve default axes limits
Ntk=10; % pick a number of ticks desired
ax.XTick=linspace(xtk(1),xtk(2),Ntk);
Salt to suit.
I not used the timeseries object enough to know and the doc was pretty obtuse; does it store the times as explicit field or is buried in the properties and in your creation as above are the values of
GAUGE_ts.Time
datetimes equiavelent to Dates? I'm presuming that's so in which case you could eliminate creating the other variable as a minor efficiency.
If you want the axes limits different, just do the same thing as above to set the axis limits; and then set the ticks to match.
It does seem as though a useful enhancement would be to be able to specify number of major ticks as well rather than requiring the tick values...
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!