I'm experiencing a small formating glitch with an histogram. I want to define an histogram with a square frame, with precise vertical ticks from 0 to 10. But I'm still getting a larger range, and I don't know why. Here's a working code which shows the problem :
velocity[n_, r_] := velocity[n, r] = RandomReal[{0, 1}]
ca[n_, r_] := ca[n, r] = RandomReal[{-1, 1}]
phi[n_, r_] := phi[n, r] = RandomReal[{0, 2 Pi}]
V0[n_, r_] := V0[n, r] = velocity[n, r] {
Sqrt[1 - ca[n, r]^2] Cos[phi[n, r]],
Sqrt[1 - ca[n, r]^2] Sin[phi[n, r]],
ca[n, r]
}
Manipulate[
Histogram[
Table[Norm[V0[n, r]], {n, 1, Np}], {0.05},
ColorFunction -> Function[{height}, Opacity[height]],
ChartStyle -> Purple,
PlotRange -> {{0, 1}, {0, 10}},
AspectRatio -> 1,
Axes -> False,
Frame -> True,
GridLines -> Automatic,
FrameLabel -> {
Style["Velocity", 14],
Style["Number of particles", 14]
},
ImageSize -> {500, 500}
],
{{Np, 1, Style["N", 14, Italic, FontFamily -> "Times"]}, 1, 100, 1},
Delimiter,
Row[{
Button[Style["Randomizer", Bold, Red, 12], {r = RandomReal[]},
Appearance -> "Palette",
ImageSize -> {100, 24}
]
}],
ControlPlacement -> Bottom,
FrameMargins -> None
]
So what am I doing wrong with this code ?
PlotRangePadding -> 0
the answer? $\endgroup$Show[...]
apparently solves completely the output problem. $\endgroup$Manipulate
. $\endgroup$