How to label x-axis of stem plot that consist spectrum?
조회 수: 5 (최근 30일)
이전 댓글 표시
I am plotting the graph using stem. What code should I write to label the x-axis with spectrum? I have tried xticklabels but it is not working.

댓글 수: 2
Dyuman Joshi
2023년 1월 29일
Do you want to include those x values to have ticks as well?
If that is not something you want to do, please specify exactly what you want to achieve.
dpb
2023년 1월 29일
편집: dpb
2023년 1월 29일
The spacing is too close for extra tick labels to work well, probably. If the idea is to identify the values at the locations of the plotted values, an annotation/text at the locations of interest is probably the way to go. See <a recent thread> for the idea; salt to suit...
답변 (1개)
Dinesh
2023년 3월 29일
Hi Teoh Chee Jin,
As per my understanding, you are trying to have a xtick for each observation on the plot. We can change the input value to 'xticks' function to solve the problem. Let 'observations' be the array of x-axis co-ordinates then.
ticks = -2 : 2
ticks = sort([ticks observations])
xticks(ticks)
Hope this helps,
Thank You!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Axis Labels에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!