How do I convert a linear scale array to a logarithmic without getting negative values?
Mostra commenti meno recenti
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 Commento
Rik
il 6 Lug 2020
You would have to remove those.
Risposte (1)
madhan ravi
il 6 Lug 2020
0 voti
Replace < 1 with nan.
14 Commenti
farzad
il 6 Lug 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
il 7 Lug 2020
Rik
il 7 Lug 2020
You can change the axis if you like. What exactly do you want to happen?
farzad
il 7 Lug 2020
madhan ravi
il 7 Lug 2020
set(gca, 'XScale', 'log')
farzad
il 7 Lug 2020
Rik
il 7 Lug 2020
In X or Y?
farzad
il 7 Lug 2020
farzad
il 8 Lug 2020
farzad
il 9 Lug 2020
madhan ravi
il 9 Lug 2020
Nope
farzad
il 9 Lug 2020
farzad
il 9 Lug 2020
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
