How to label x-axis of stem plot that consist spectrum?

2 次查看(过去 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
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
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
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)
If you want to just label the locations of the plot values then read this thread.
For more information on ‘xticks’ function refer the following MATLAB documentation.
Hope this helps,
Thank You!

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by