# How to plot Log(P(x)) in a histogram?

I have been using SmoothHistogram to plot the probability density function $$P(x)$$ of some experimental data. On the y-axis, I would like to have $$\log(P(x))$$ instead of $$P(x)$$. I do not want a log scale: the y-axis would have negative values. This is an example of code I have been using:

SmoothHistogram[Table[RandomVariate[NormalDistribution[]], {it, 1,10^5}], Automatic, "PDF", Frame -> True, PlotRange -> All, FrameLabel -> {"x", "p(x)"}]


Maybe I could try to extract information from SmoothHistogram and use ListPlot?

I've been using Mathematica 10.0 . Thank you.

\$Version

(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)

Clear["Global"]


There is no need to use Table with RandomVariate to generate multiple values.

SeedRandom;

data = RandomVariate[NormalDistribution[], 10^5];

SmoothHistogram[data, Automatic, "PDF", Frame -> True, PlotRange -> All,
FrameLabel -> {"x", "p(x)"}] The distribution corresponding to SmoothHistogram is SmoothKernelDistribution

Plot[PDF[SmoothKernelDistribution[data], x], {x, -4, 4}, Frame -> True,
PlotRange -> All, FrameLabel -> {"x", "p(x)"}] Plotting the Log of the PDF is straightforward.

Plot[Log@PDF[SmoothKernelDistribution[data], x], {x, -4, 4}, Frame -> True,
PlotRange -> All, FrameLabel -> {"x", "Log(p(x))"}]
` 