Re: Re: another Epilog LogPlot problem
- To: mathgroup at smc.vnet.net
- Subject: [mg101837] Re: [mg101829] Re: another Epilog LogPlot problem
- From: "David Park" <djmpark at comcast.net>
- Date: Sat, 18 Jul 2009 08:01:20 -0400 (EDT)
- References: <h3n5vt$2i9$1@smc.vnet.net> <32316171.1247908666858.JavaMail.root@n11>
WRI has pulled an inconsistency on you. The underlying y coordinate for the
Histogram plot is Log10, but the underlying y coordinate for the LogPlot is
(natural) Log (even though the tick marks might lead you to think it is
Log10.) So use the following:
Histogram[{RandomReal[NormalDistribution[0,1],2000]},{-4,4,.02},"LogProbabil
ityDensity",
ChartBaseStyle->EdgeForm[None],
AxesOrigin->{0,Log10[.01]},
PlotRange->{{-3,3},Log10[{.01,0.8}]},Epilog->First@Plot[Log10@PDF[NormalDist
ribution[0,1],x],{x,-3,3},PlotRange->{{-3,3},All}]]
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: Mark K [mailto:brac71 at yahoo.com]
Here is a simple example to demonstrate the "bad" behaviour of
LogPlot
when used in an Epilog to a LogProbabilityDensity Histogram, which I
mentioned in my original post/question.
(Basically you can see that the Epilog plot gives the wrong scaling,
putting the peak incorrectly at ~0.12 instead of ~0.4. )
Histogram[{RandomReal[NormalDistribution[0, 1], 2000]}, {-4,4, .02},
"LogProbabilityDensity", ChartBaseStyle -> EdgeForm[None], AxesOrigin
-> {0, Log10[.01]}, PlotRange -> {{-3, 3}, Log10[{.01, 0.8}]} ,
Epilog -> First@LogPlot[PDF[NormalDistribution[0, 1], x], {x, -3, 3},
PlotRange -> {{-3, 3}, {.01, .8}}] ]
On Jul 16, 2:21 pm, MarkK <bra... at yahoo.com> wrote:
> Hello, I am wondering how to overlay a LogPlot onto a
> LogProbabilityDensity histogram, and have the correct scaling.
> I.e., if I make a "LogProbabilityDensity"-typed histogram
> (with appropriate PlotRange including Log10[{ymin, ymax}]),
> then trying to plot a function on top of that using
> Epilog -> First@LogPlot[{P[x]}, {x,xmin,xmax}, PlotRange ->
> {{xmin,xmax}, {ymin, ymax}}]
> gives me an incorrectly scaled plot on top of the histogram.
>
> How can I fix this? Should making a LogPlot of a function over a Log-
> histogram be so difficult?
>
> thanks, --Mark [mkel at risoe dot dtu dot dk]