Non-numeric x-axis labelling?
조회 수: 54 (최근 30일)
이전 댓글 표시
I have three data sets with the same number of points, that each represent the period from high tide to low tide, with a data set corresponding to data from a given day. The data is aligned so that high tide for all three is the same data point, and low tide is the same data point, but these occur at different times of day. 30 data points covers 1 hour.
I want to label the x-axis as HT, HT+1 (to denote 1 hour after high tide), HT+2 (to denote 2 hours after high tide) etc but have no idea how to do this, and can't succinctly describe what I'm trying to do so I'm struggling to find information when I search. Does anyone have any guidance or knowledge about how to do this?
Thanks!
댓글 수: 0
채택된 답변
Clayton Gotberg
2021년 4월 17일
편집: Clayton Gotberg
2021년 4월 17일
plot(<plot data>)
x_label_locations = [0 1 2]
x_labels = {'HT','HT+1','HT+2'}
xticks(x_label_locations)
xticklabels(x_labels)
If you prefer, you can also assign these directly to the axes properties:
plot(<plot data>)
x_label_locations = [0 1 2]
x_labels = {'HT','HT+1','HT+2'}
ax = gca; % Get current axes being plotted to
ax.XTick = x_label_locations;
Ax.XTickLabel = x_labels;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Oceanography and Hydrology에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!