How do I convert a linear scale array to a logarithmic without getting negative values?
Afficher commentaires plus anciens
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 commentaire
Rik
le 6 Juil 2020
You would have to remove those.
Réponses (1)
madhan ravi
le 6 Juil 2020
0 votes
Replace < 1 with nan.
14 commentaires
farzad
le 6 Juil 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
le 7 Juil 2020
Rik
le 7 Juil 2020
You can change the axis if you like. What exactly do you want to happen?
farzad
le 7 Juil 2020
madhan ravi
le 7 Juil 2020
set(gca, 'XScale', 'log')
farzad
le 7 Juil 2020
Rik
le 7 Juil 2020
In X or Y?
farzad
le 7 Juil 2020
farzad
le 8 Juil 2020
farzad
le 9 Juil 2020
madhan ravi
le 9 Juil 2020
Nope
farzad
le 9 Juil 2020
farzad
le 9 Juil 2020
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
