The lognormal density function is usually plotted on a linear x axis. I find it useful to visualize the lognormal density on a logarithmic x axis (for example when choosing a lognormal prior in a Bayesian model). To do so, initially I would simply take the log of the x axis and plot the density, but I soon realized that this didn't look right (the median on the linear x axis plot wouldn't match the mean on the log x axis plot). After some study I realized that changing the coordinates is equivalent to transforming the random variable, and I needed to scale the lognormal density by a factor of $x$ in order to plot it on a logarithmic x axis as shown in the graph below:
meanlog = 0; sdlog = 1
par(mfrow=c(1,2))
xlim = c(qlnorm(0.001, meanlog=meanlog, sdlog=sdlog),
qlnorm(0.999, meanlog=meanlog, sdlog=sdlog))
x = seq(xlim[1], xlim[2], length.out=10000)
y = dlnorm(x, meanlog=meanlog, sdlog=sdlog)
plot(x, y, type="l", xlab="x", ylab="Density",
main="Linear x axis")
abline(v=exp(meanlog)); text(exp(meanlog)+1.8, 0.405, "Median")
plot(log(x), y*x, type='l', xlab="x", ylab="Density", xaxt="n",
main="Logarithmic x axis")
abline(v=meanlog); text(meanlog+0.5, 0.405, "Median")
lims = par("usr")[1:2]; base = exp(1)
lims = base^lims
minPow = floor(log10(lims[1])); maxPow = ceiling(log10(lims[2]))
powSeq = seq(minPow, maxPow); axSeq = 10^powSeq
axis(1, at=log(axSeq, base=base), labels=as.character(axSeq))
for (i in 1:length(axSeq)){
bb = (1:10)/10; a = (bb*10^powSeq[i]);
axis(1, at=log(a, base=base), tcl=-0.25, labels=F)
}
The rationale for the scaling factor is provided below:
Suppose that $W$ is lognormally distributed, and $X = \ln(W)$, so $e^X = W$. The distribution function of $X$ is:
$F_X(x) = P(X \le x) = P (X \le \ln(w)) = P(e^X \le w) = P(W \le w) = L_X(e^x)$
where $L_X(x)$ is the lognormal distribution function. The density function of $X$ can be obtained by differentiating its distribution function:
$f_X(x) = \frac{d}{dx} L_X(e^x) = e^x l_X(e^x) = w l_X(w)$
where $l_X(x)$ is the lognormal density function.
Although I'm fairly confident that the arguments above are correct I'm not a statistician or mathematician, and I would appreciate if more qualified users could either confirm them or correct them.