How do I convert a linear scale array to a logarithmic without getting negative values?
显示 更早的评论
Hi All
I need to plot ( bar plot) values, and on the X axis , I want to convert them to logarithmic, but the values <1 become negative. how to avoid and fix it ?
回答(1 个)
madhan ravi
2020-7-6
0 个投票
Replace < 1 with nan.
14 个评论
farzad
2020-7-6
f=barh(y, max(0,log(x)), 'basevalue', 0);
If you want to replace values, you will have to store the intermediate result, or write a function that does that.
farzad
2020-7-7
Rik
2020-7-7
You can change the axis if you like. What exactly do you want to happen?
farzad
2020-7-7
madhan ravi
2020-7-7
set(gca, 'XScale', 'log')
farzad
2020-7-7
Rik
2020-7-7
In X or Y?
farzad
2020-7-7
farzad
2020-7-8
farzad
2020-7-9
madhan ravi
2020-7-9
Nope
farzad
2020-7-9
farzad
2020-7-9
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
