How do I convert a linear scale array to a logarithmic without getting negative values?
3 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
madhan ravi
2020-7-6
Replace < 1 with nan.
14 个评论
farzad
2020-7-6
this is what I do , I take the log immediately when I am plotting I doubt I can do what you say, how do I do that ?
f=barh(y, log(x), 'basevalue', min(x));
farzad
2020-7-7
thank you very much for your answer. yes this is right but : I think something is wrong.
Because : here we are actually taking the logarithm of the X axis values. so if the maximum is 10^ 4 , the max on the logarithmic will be 4.
but I meant only changing the scale of showing the values , therefore , not touching the actual X values, but changing the X values. the same way it is done in Excel.
farzad
2020-7-7
please see the attached. the distances of the lines is in logarithmic scale. this is how you can do in Excel :
farzad
2020-7-7
Thank you ! it worked on scaling , but all the bars disappeared ! I wanted to use the log scale to see the small bars better !
farzad
2020-7-8
Any opinions on why the bars disappear ? the divisions start from 10^-1 to 10^4 and I should have a graph in this range
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)