Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: PlotRange with Histogram Log height
Replies: 3   Last Post: Nov 6, 2013 12:23 AM

 Messages: [ Previous | Next ]
 Bob Hanlon Posts: 906 Registered: 10/29/11
Re: PlotRange with Histogram Log height
Posted: Nov 6, 2013 12:22 AM

You must take the Log of the vertical axis range values

data = RandomVariate[
TruncatedDistribution[{-2, 2},
NormalDistribution[0, 0.5]], 1000];

Histogram[data, 10, {"Log", "PDF"},
PlotRange -> {{-2, 2}, Automatic},
Frame -> True,
PlotRangeClipping -> True]

Histogram[data, 10, {"Log", "PDF"},
PlotRange -> {{-2, 2}, Log /@ {0.01, 1.0}},
Frame -> True,
PlotRangeClipping -> True]

However, since Log is Listable, this can be shortened slightly to

Attributes[Log]

{Listable, NumericFunction, Protected}

Histogram[data, 10, {"Log", "PDF"},
PlotRange -> {{-2, 2}, Log@{0.01, 1.0}},
Frame -> True,
PlotRangeClipping -> True]

Bob Hanlon

On Mon, Nov 4, 2013 at 11:18 PM, Jeff <jbwjbwjbw@gmail.com> wrote:

> I am trying to draw a histogram with log heights with a specified
> PlotRange. This command works fine:
>
> Histogram[data, 10, {"Log", "PDF"},
> PlotRange -> {{-2, 2}, Automatic}, Frame -> True,
> PlotRangeClipping -> True]
>
> But what I need is the ability to control the range of the vertical axes.
> When I change the "Automatic" to something specific I get a blank graph.
> For example, this fails
>
> Histogram[data, 10, {"Log", "PDF"},
> PlotRange -> {{-2, 2}, {0.01, 1.0}}, Frame -> True,
> PlotRangeClipping -> True]
>
> I am using Mathematica 9.0.1.0 on OSX 10.8.5. Any help would be
> appreciated.
>
>

Date Subject Author
11/6/13 Bob Hanlon
11/6/13 Jeff