How do I convert a linear scale array to a logarithmic without getting negative values?
Mostrar comentarios más antiguos
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 comentario
Rik
el 6 de Jul. de 2020
You would have to remove those.
Respuestas (1)
madhan ravi
el 6 de Jul. de 2020
0 votos
Replace < 1 with nan.
14 comentarios
farzad
el 6 de Jul. de 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
el 7 de Jul. de 2020
Rik
el 7 de Jul. de 2020
You can change the axis if you like. What exactly do you want to happen?
farzad
el 7 de Jul. de 2020
madhan ravi
el 7 de Jul. de 2020
set(gca, 'XScale', 'log')
farzad
el 7 de Jul. de 2020
Rik
el 7 de Jul. de 2020
In X or Y?
farzad
el 7 de Jul. de 2020
farzad
el 8 de Jul. de 2020
farzad
el 9 de Jul. de 2020
madhan ravi
el 9 de Jul. de 2020
Nope
farzad
el 9 de Jul. de 2020
farzad
el 9 de Jul. de 2020
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
