# Translating Histogram

SeedRandom[1];
RandomVariate[NormalDistribution[], 100];
Histogram[%, Automatic, "Probability"]


The above code produces a histogram like

I want to translate the figure by say $\{1,1\}$ as follows:

Can someone help me do this?

Update: An alternative approach is to use ChartElementFunction:

Histogram[data, Automatic, "Probability", ChartStyle -> "Rainbow",
ChartElementFunction -> (ChartElementDataFunction["GlassRectangle"][1 + #, ##2] &),
AxesOrigin -> {-3, 1}, PlotRange -> All]


Original post:

SeedRandom[1];
data = RandomVariate[NormalDistribution[], 100];
hist = Histogram[data, Automatic, "Probability"]

Show[MapAt[Translate[#, {1, 1}] &, hist, {1}],
AxesOrigin -> {-3, 1}, PlotRange -> {{-3, 4}, {1, 1.5}}]


Alternatively, post-process Rectangles:

Show[hist /. RectangleBox[{x0_, y0_}, {x1_, y1_}, z___] :>
RectangleBox[1 + {x0, y0}, 1 + {x1, y1}, z],
AxesOrigin -> {-3, 1}, PlotRange -> {{-3, 4}, {1, 1.5}}]
(* same picture *)

• Thank you, this exactly what i needed – user13892 Apr 15 '15 at 21:36
• @user13892, my pleasure. Welcome to mma.se. – kglr Apr 15 '15 at 21:37

You could just re-write the Ticks:

Histogram[mydata, Automatic, "Probability",
Ticks -> {{#, # + 1, {0.015, 0}} & /@  Range[-3, 3],
{#, # + 1, {0.015, 0}} & /@ Range[0, 0.35, 0.05]}]


Minor ticks are left as an exercise for the reader.

To shift left-to-right, merely add $1$ to each sampled point:

SeedRandom[1];
1 + #& /@ RandomVariate[NormalDistribution[], 100];
Histogram[%, Automatic, "Probability"]


If one lists the vertical axis as "probability," then surely one doesn't want to add $1$ to each abscissa value as that would violate the definition of a probability measure.

• This doesn't add $1$ to vertical axis. – Mahdi Apr 15 '15 at 21:24