y-axis only absolute values
16 次查看(过去 30 天)
显示 更早的评论
Hi folks,
Is there a easy way to set the y-axis values to their absolute values such that there are only positive numbers on the y-axis?
Thank you for answers,
Cheers Sam
1 个评论
José-Luis
2014-6-13
What do you want to do about the negative values in your plot? Just not show them?
回答(2 个)
dpb
2014-6-13
Sure,
plot(x,abs(y))
I'm guessing that's not what you mean, precisely, however. If you mean instead to simply display abs() of tick labels even if the y-limits include some negatives, then try
set(gca,'yticklabel',num2str(abs(get(gca,'ytick').')))
2 个评论
另请参阅
类别
在 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!