Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a histogram, if I create it without specifying the PlotRange it works fine and the ticks on the Y-Axis are displayed

Histogram[{myData}, {10000}, PlotRange -> {Automatic, Automatic}]

However if I indicate the PlotRange they vanish

Histogram[{myData}, {10000}, PlotRange -> {{0, 200000}, Automatic}]

I tried setting the Ticks manually:

Histogram[{myData}, {10000}, PlotRange -> {{0, 200000}, Automatic}, 
          Ticks -> {{0, 50000, 100000, 150000, 200000}, 
                    {0, 100, 200, 300, 400, 500, 600, 700}}]

but Mathematica stubbornly refused to display them.
Does anyone know how fix this?

share|improve this question
I noticed, oddly, that if I leave out the bin width argument {10000} then I don't have this problem –  ekcrisp Apr 19 '14 at 20:01
I also noticed that this does not happen with smaller data sets –  ekcrisp Apr 19 '14 at 20:26

1 Answer 1

Instead of PlotRange->{{0,x},Automatic} to display your data from 0 till $x$, you can use PlotRange->{{All,x},All} or PlotRange->{{Automatic,x},All}. The plot then includes the ticks and labels on the $y$-axis, and the PlotRange All ensures that it extends sufficiently high, as in this example:

mydata = RandomVariate[ExponentialDistribution[1], 10^4];
Histogram[mydata, PlotRange -> {{All, 5}, All}]

histogram with PlotRange and y axis ticks and marks

This works independently of whether you indicate the bins or not.

share|improve this answer
Another option is to keep OP's plot range spec, but add the option AxesOrigin->{0,0}. Which removes the small gap between the histogram bar and the axis. This is just a stylistic choice though. +1 –  N.J.Evans Jun 17 at 15:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.