Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 '15 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.