Why does histogram gives issues? I rephrased my question
4 views (last 30 days)
Show older comments
Sadiq Akbar on 16 Nov 2022
Commented: Sadiq Akbar on 20 Nov 2022
I have the following set of data:
Each set of fitness1, fitness2 and fitness3 has 100 independent elements. I want to plot its histogram such that the x-axis is logrithmic having values like 10^-2, 10^-3, 10^-4....and the y-axis shows us how many elements have that corresponding fitness values in each fitness? Say for example we have 10^-3 on axis, so how many values in each fitness1, fitness2 and fitness3 are there having values in the range of 10^-3. Likewise, if we have 10^-5 on x-axis, then how many values in side each fitness are there having this range of 10^-5 and so on. I tried the following but its not like the one in the attachment.
[~,edges1] = histcounts(log10(fitness2sn35));%[~,edges] = histcounts(log10(x));
[~,edges2] = histcounts(log10(fitness2sn45));
histogram([log10(fitness2sn35) log10(fitness2sn45)] )% histogram(log10(fitness2sn35))
I want a grpah like this, but I don't get like this?
Steven Lord on 16 Nov 2022
x = rand(1, 1e5)*1e-5;
ax = axes;
Specify bins edges with logarithmic spacing.
h = histogram(ax, x, 10.^(-10:-5));
Set the XScale property of the axes to 'log'. You need to do this after the call to histogram not before.
ax.XScale = 'log';
Image Analyst on 17 Nov 2022
See my collection of demos attached that put insets within larger axes.
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!