Re: another Epilog LogPlot problem
- To: mathgroup at smc.vnet.net
- Subject: [mg101814] Re: another Epilog LogPlot problem
- From: Fred Bartoli <""@news.free.fr>
- Date: Sat, 18 Jul 2009 04:49:35 -0400 (EDT)
- References: <h3n5vt$2i9$1@smc.vnet.net>
- Reply-to: myname_with_a_dot_inbetween at free.fr
MarkK a =E9crit :
>> 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]
>>
>
>here is a simple example to replicate the ("bad") behaviour of LogPlot
>as an Epilog to a LogProbabilityDensity Histogram, using a Normal
>distribution.
>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}}] ]
>
Mark,
that one works:
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@Plot[Log10@PDF[NormalDistribution[0,1],x],
{x,-3,3},PlotRange->{{-3,3},Log10 at {.01,.8}}]]
Clearly the Epilog can't handle Log plots and you have to use a linear
plot and use axis transformations within the Plot function. At least the
workaround isn't so bad.
--
Thanks,
Fred.