I am trying to make a chart where the x-axis has a log scale and the y-axis is in reverse order. I tried to use LogLinearPlot, and I tried to combine it with ScalingFunctions. My code was:

LogLinearPlot[1/x, {x, 1, 1000}, ScalingFunctions->"Reverse"]

But this failed. So I tried using Plot and ScalingFunctions:

Plot[1/x, {x, 1, 1000}, ScalingFunctions -> {"Log", "Reverse"}]

That gave me an error as well. I noticed that ScalingFunctions works just fine when applied to the y-axis, as in:

Plot[1/x, {x, 1, 1000}, ScalingFunctions -> "Log"]
Plot[1/x, {x, 1, 1000}, ScalingFunctions->"Reverse"]

However, when I apply ScalingFunctions to the x-axis, it will give an error; for example:

Plot[1/x, {x, 1, 1000}, ScalingFunctions -> {"Log", Identity}]

Can anyone tell me what to do to get a reversed y-axis and a logarithmic x-axis at the same time?


At least in v8, the following:

Reap@Plot[1/x, {x, 1, 1000}, ScalingFunctions -> (Sow@## &)]

reveals that the only argument passed to ScalingFunctions is the y coordinate. So, it wont scale the x axis.

But instead you may post-process the ticks generated by default:

k[f_] := Show[#, AbsoluteOptions[#, Ticks] /. {x_, x_, y__} :> {x, -x, y}] &@
                                                                LogLinearPlot[-f[x], {x, 1, 1000}]
f[x_] := 1/x;

Mathematica graphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.