MATLAB: How to generate equal visual witdh bars with bar graph and log absciss scale

bar graphiclogarithmic scale issuewidth bar issue

Hello everyone,
My problem is that I want to obtain a graph similar to this one (consider the green bars only) with Matlab.
The things is that with a logarithmic absciss scale with Matlab, I obtain:
Is there a way to generate bars with a width that increase when this bar is located on the right of the absciss scale in order to hev "visualy" the same width for each bar ?
N.B : I put my code as an attached file but it is quite simple.

Best Answer

  • Instead of making the x-scale logarithmic by set(gca, 'xscale','log'), use linear x-scale and log10(Frequency) as X