# Problems with log-log histograms

I'm using a custom function to create Log-Log Histograms of my data. It uses the CustomTicks package (in LevelScheme, http://scidraw.nd.edu/levelscheme/) to display Log Ticks.

Needs["CustomTicks"];

domainSizesHistogram[data_List,opts:OptionsPattern[]]:=
Module[{},(
Histogram[
Log[10,data],
{-0.05,5.05,0.1},
"LogCount",
opts,
AxesLabel->{"Basin of attraction", "Number of attractors"},
PlotRange->{Automatic,{-1,9}},
Ticks->{CustomTicksLogTicks[0,5],Automatic}
]
)]


It's got to be Log-Log because my simulations produce highly varied output and I would like to generate histograms to quickly compare the output of different runs.

Although the function generally works fine, it sometimes produces incorrect histograms.

data1 = {32, 20, 63, 234, 12, 50, 1, 332, 11, 210, 116, 88, 11, 68, 194, 202, \
11, 46, 116, 3, 41, 236, 41, 9, 23,
48, 3, 52, 72, 20, 10, 9, 191, 52, 148, 50, 15, 105, 92, 130, 50, \
12, 244, 131, 159, 55, 189, 161, 83,
17, 22, 7, 36, 51, 15, 132, 130, 42, 6, 51, 79, 39, 10, 4, 32, 13, \
63, 83, 68, 28, 8, 1, 48, 44, 144, 28,
4, 19, 19, 54, 71, 276, 32, 39, 1, 20, 38, 72, 64, 60, 3, 93, 28, \
17, 56, 50, 7, 41, 3, 39, 11, 4, 30,
49, 58, 7, 87, 15, 10, 13, 4, 51, 8, 6, 42, 21, 67, 8, 14, 19, 4, \
2, 49, 56, 15, 3, 58, 11, 5, 15, 5, 4,
1, 27, 9, 34, 41, 3, 13, 14, 48, 69, 5, 38, 26, 8, 31, 23, 2, 21, \
28, 22, 28, 40, 14, 1, 14, 19, 1, 1,
19, 8, 3, 35, 3, 61, 1, 18, 23, 21, 25, 28, 42, 5, 2, 11, 9, 3, 2, \
1, 50, 56, 13, 9, 14, 5, 19, 2, 2, 12,
67, 6, 11, 1, 14, 7, 73, 23, 11, 2, 4, 10, 10, 3, 2, 8, 12, 4, 12, \
1, 8, 43, 6, 10, 15, 7, 6, 9, 9, 17,
4, 6, 9, 2, 7, 9, 4, 2, 3, 25, 7, 2, 18, 4, 5, 13, 1, 16, 5, 13, \
25, 9, 13, 13, 2, 5, 3, 2, 2, 3, 10, 8,
32, 12, 4, 5, 14, 6, 2, 6, 26, 4, 15, 10, 3, 11, 10, 8, 5, 6, 3, \
6, 2, 12, 3, 2, 7, 19, 14, 21, 6, 13, 2,
21, 3, 5, 1, 3, 6, 4, 2, 15, 2, 11, 6, 12, 2, 2, 10, 1, 14, 2, 5, \
1, 2, 1, 3, 2, 3, 2, 2, 1, 5, 2, 4, 7,
7, 6, 4, 2, 2, 13, 12, 4, 10, 5, 2, 2, 3, 7, 4, 1, 8, 4, 2, 4, 3, \
8, 4, 1, 2, 1, 6, 1, 1, 5, 1, 6, 8, 6,
3, 4, 6, 2, 1, 1, 1, 1, 2, 10, 1, 2, 3, 3, 5, 5, 8, 4, 1, 3, 1, 1, \
5, 2, 1, 6, 4, 2, 4, 6, 1, 5, 3, 4, 1,
6, 4, 2, 2, 2, 1, 1, 2, 1, 4, 5, 2, 3, 5, 4, 2, 2, 2, 3, 2, 1, 2, \
1, 1, 4, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3,
1, 3, 3, 1, 1, 5, 1, 1, 2, 1, 2, 2, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, \
5, 1, 2, 3, 2, 3, 1, 3, 1, 1, 2, 1, 2,
1, 1, 4, 1, 2, 1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 3, 1, 2, 2, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
2, 1, 1, 1, 1};

data2 = {2655, 72, 3862, 2414, 577, 307, 21, 38, 8, 41, 4, 1};


domainSizesHistogram[data1] produces a normal histogram:

But domainSizesHistogram[data2] gives a histogram where the axes are all messed up:

How can I fix the function to always produce a histogram with the same axes? I already tried to set a hard PlotRange for both axes, but this didn't produce the right results either. Some of my fixes seemed to produce the right axes, but then the bars would float above the horizontal axis.

Any help would be appriciated.

Edit:

After adding AxesOrigin->{-0.05,-1} to the function, a lot of problem were solved. However, now I get floating bars in some cases.

data3 = {4535, 5465};

And domainSizesHistogram[data3] produces this:

• Can't you use an option AxesOrigin->{0,0} ? – b.gates.you.know.what Dec 12 '12 at 10:32
• @b.gatessucks, AxesOrigin -> {0,-1} already gives some improvement, but I can't find the x-value so that values of 1 (10^0) on the horizontal axis fall within the graph. – jlmr Dec 12 '12 at 10:41
• You can get the position of the axes origin with Cases[Histogram[data2, "Log", "LogCount"], Rule[AxesOrigin, origin_] -> origin, Infinity ]. – b.gates.you.know.what Dec 12 '12 at 10:58
• @b.gatessucks, thanks, that fixed most of the problems, however one nagging issue still remains. I edited my question with the last problem (as far as I can see right now). – jlmr Dec 13 '12 at 19:43
• Let's wait for some LevelScheme` experts; I never used it and can't help further for now. – b.gates.you.know.what Dec 13 '12 at 19:46