I have a bit of a strange problem. I'd like to overlay 3 different logarithmic Histograms with two of them stacked and one separate [*]. Without weights the solution is simple:
data1 = RandomVariate[NormalDistribution[1, 3], 10^3];
data2 = RandomVariate[NormalDistribution[5, 3], 10^3];
data3 = RandomVariate[NormalDistribution[10, 3], 10^3];
Show[Histogram[{data1, data2}, ChartLayout -> "Stacked", ScalingFunctions -> {None, "Log"}],Histogram[data3, ChartStyle -> Red, ScalingFunctions -> {None, "Log"}]]
However, this doesn't look nice when I have weighted data and I can't figure out a way to fix it. The issue is that Mathematica doesn't know where to end the histogram of data1 and data2. I tried the following:
data1 = WeightedData[RandomVariate[NormalDistribution[1, 3], 10^3], Table[1, {i, 1, 10^3}]];
data2 = WeightedData[RandomVariate[NormalDistribution[5, 3], 10^3], Table[1, {i, 1, 10^3}]];
data3 = WeightedData[RandomVariate[NormalDistribution[10, 3], 10^3], Table[0.1, {i, 1, 10^3}]];
Show[Histogram[{data1, data2}, ChartLayout -> "Stacked", ScalingFunctions -> {None, "Log"}], Histogram[data3, ChartStyle -> Red, ScalingFunctions -> {None, "Log"}]]
which gives,
$\hspace{3cm}$
Swapping which histogram is first in Show makes things worse and playing with PlotRange was also no use.
[*] I emphasize that I'd like two of this histograms stacked because I think one can put all the histograms in a single Histogram function if this is not the case and there is no problem any more.