4
$\begingroup$

Bug introduced in 10.0.0 and fixed in 10.0.1


In version 9, DensityHistogram worked with PlotRange as expected:

SeedRandom[0]
DensityHistogram[
 Transpose[{RandomReal[NormalDistribution[], 1000], 
   RandomReal[NormalDistribution[], 1000]}],
 PlotRange -> {{0, 3}, {0, 3}}
]

enter image description here

In version 10, the upper bound (3) is obeyed (with some new padding) but the lower bound (0) is ignored:

enter image description here

How can I make DensityHistogram obey the lower bound in PlotRange?

$\endgroup$
4
$\begingroup$

Not sure why PlotRange doesn't work (might need to report wolfram technical support), for workaround you could wrap it with Show:

SeedRandom[0]
Show[DensityHistogram[
  Transpose[{RandomReal[NormalDistribution[], 1000], 
    RandomReal[NormalDistribution[], 1000]}]], 
 PlotRange -> {{0, 3}, {0, 3}}]

enter image description here

$\endgroup$
3
$\begingroup$

To get a plot very similar to the version 9 plot:

SeedRandom[0]
DensityHistogram[
 Transpose[{RandomReal[NormalDistribution[], 1000], 
  RandomReal[NormalDistribution[], 1000]}], 
 PlotRangePadding -> {{-3.4, -1.4}, {-3.4, 0}}, PlotTheme -> "Classic"]

strangePadding

Looks like a bug.


Specifying bin delimiters is an other option:

SeedRandom[0]
DensityHistogram[
 Transpose[{RandomReal[NormalDistribution[], 1000], 
 RandomReal[NormalDistribution[], 1000]}], {-0.5, 3.5, 0.5}]

using bin delimiters

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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