How do I convert a linear scale array to a logarithmic without getting negative values?
Ältere Kommentare anzeigen
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 Kommentar
Rik
am 6 Jul. 2020
You would have to remove those.
Antworten (1)
madhan ravi
am 6 Jul. 2020
0 Stimmen
Replace < 1 with nan.
14 Kommentare
farzad
am 6 Jul. 2020
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
am 7 Jul. 2020
Rik
am 7 Jul. 2020
You can change the axis if you like. What exactly do you want to happen?
farzad
am 7 Jul. 2020
madhan ravi
am 7 Jul. 2020
set(gca, 'XScale', 'log')
farzad
am 7 Jul. 2020
Rik
am 7 Jul. 2020
In X or Y?
farzad
am 7 Jul. 2020
farzad
am 8 Jul. 2020
farzad
am 9 Jul. 2020
madhan ravi
am 9 Jul. 2020
Nope
farzad
am 9 Jul. 2020
farzad
am 9 Jul. 2020
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
