I have been puzzled by the following issue:
When I am using LogLogPlot
, while the graph of the function is transformed into the corresponding logarithmic expression, the values on the x
and y
axes remain the same. A good example is the following, taken from the documentation:
LogLogPlot[x^2, {x, 0.1, 10}]
When at x=10
the value of x^2
at $y$ axis should be, as correctly shown 100
but at a LogLogPlot
, with Log[10,x]
it should be: $\text{Log} (10^2)=2 \text{Log} 10=2$. Also, at x=10
the $x$ axis should be equivalently $\text{Log 10} =1$. But none of this is happening.
How is it possible to tell Mathematica to show the logarithmic values of the function and not the original ones?
Answer
A couple of ways:
Log-parametric plot:
ParametricPlot[Log10@{x, x^2}, {x, 0.1, 10}, AspectRatio -> 0.6]
Redefining the ticks (note that LogLogPlot
transforms the coordinates by the natural logarithm, so the ticks have to be scaled by Log[10]
to get common logarithm coordinate markings):
Show[LogLogPlot[x^2, {x, 0.1, 10}],
Ticks -> {Charting`ScaledTicks[{#*Log[10] &, #/Log[10] &}],
Charting`ScaledTicks[{#*Log[10] &, #/Log[10] &}]},
PlotRangePadding -> Scaled[.05] (*OR*) (*AxesOrigin -> {Log[0.1],Log[0.01]}*)]
Instead of PlotRangePadding
(no vertical axis in V11.1.1 if omitted), one can also control the axes with AxesOrigin
.
Comments
Post a Comment