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 件のコメント
Rik
2020 年 7 月 6 日
You would have to remove those.
回答 (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!
