How to cleanly display dates on X axis
Afficher commentaires plus anciens
I have an array of dates in yyyy-mm-dd HH:ii:ss format. I want to use this to display on X-axis label. I used following command
set(gca, 'XTick',1:size(datetimebl,1), 'XTickLabel',datetimebl);
xticklabel_rotate([],90);
But this causes x axis labels to go out of figure and overlap then I rotated x labels using xticklabel_rotate command as shown in image but still labels go out of figure. There are more labels than this and they go out of figure. This is bugging me for few days please help.
Array datetimebl =
* 14-Sep-2015 18:33:23
* 14-Sep-2015 18:38:22
* 14-Sep-2015 18:43:21
* 14-Sep-2015 18:48:20
* 14-Sep-2015 18:53:19
* 14-Sep-2015 18:58:18
* 14-Sep-2015 19:03:17
* 14-Sep-2015 19:08:16
* 14-Sep-2015 19:13:15
* 14-Sep-2015 19:18:14
* 14-Sep-2015 19:23:13
* 14-Sep-2015 19:28:12
* 14-Sep-2015 19:33:11
* 14-Sep-2015 19:38:10
* 14-Sep-2015 19:43:09
* 14-Sep-2015 19:48:08
* 14-Sep-2015 19:53:07
and so on.

Réponses (2)
Thorsten
le 24 Sep 2015
0 votes
You can try to reduce the FontSize
Walter Roberson
le 24 Sep 2015
0 votes
You will need to do at least one of:
- make your xtick further apart
- reduce you font size
- increase your axes size (which might require increasing the figure size)
- largely switch to annotation arrays that put text somewhere else and draw lines to the appropriate location
- largely switch to plotting individual points in some distinguishable arrangement and legend() the labels
- largely switch to using a data cursor to allow the user to probe the fine details of the dates
Catégories
En savoir plus sur Grid Lines, Tick Values, and Labels dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!