Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
I mentioned a problem with ScalingFunctions in "mathematica.stackexchange.com/questions/16557/…; and reported a bug to Wolfram. This might be a more serious issue. –  Ernst Stelzer Feb 9 '13 at 11:49

1 Answer 1

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;
k[f]

Mathematica graphics

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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