Consider the data set

data = Table[{10^-k, 10^(-2 k)}, {k, 5}]

and the plot:


x increases from left to right

My goal is to reverse the plot direction for the abscissa. That is instead of having x increase from left to right, have x decrease when moving from left to right.

The instructions here How to change the axes' origin and direction? are not quite what is needed.

  • $\begingroup$ You've seen this? $\endgroup$ May 27, 2015 at 0:14
  • $\begingroup$ Based on @Guess's comment, here's a solution for you: ListPlot[data, ScalingFunctions -> {{Minus@*Log, Exp@*Minus}, "Log"}, AxesOrigin -> {1, 1}]. $\endgroup$ May 27, 2015 at 1:05

1 Answer 1


The ScalingFunctions option is officially documented for BarChart and similar functions, but it actually works with the *Plot functions as well! See Belisarius's comment here.

In your case, you could use it to your advantage:

data = Table[{10^-k, 10^(-2 k)}, {k, 5}]

   ScalingFunctions -> {{-Log10[#] &, 10^-# &}, "Log"}, 
   Frame -> {True, True, False, False}

ListLogLogPlot with reversed x axis

Here I am using a plot Frame rather than the Axes because I found that the latter have a disappointing tendency to now show up in log plots unless one specifies an AxisOrigin explicitly, which is typically a pain. Fortunately, however, a frame can be effectively used in lieu of axes, and it will always show up independent of the plot range.

Some standard scaling options for ScalingFunctions are shown in its documentation, such as "Log" for simple log plots, and "Reversed" to invert the values along one axis. What you want would be a combination of "Log" and "Reverse" for the x-axis. Unfortunately, however, no more than one of these built-in versions can be applied at a time, so we have to roll our own scaling function in your case.

For each axis, you provide a pair of functions to generate the desired scaling. If you'll allow me the hand-waving explanation, here is how I envision the process. The first function is applied to the raw data to determine the transformed value that will actually be plotted. Appropriate plot tick positions are then calculated internally, and the second function (typically the inverse of the first one) is applied to their value to generate the corresponding labels, so you get the effect mentioned in the documentation, i.e. ticks and gridlines showing unscaled values at scaled locations, just like one would expect for a log-log plot.

With that in mind, the "Log" scaling would be represented by a Log10[#]& scaling function; the "Reverse" scaling by a -#& function. Combine the two, and you'll obtain your desired reversed log scaling: -Log10[#]&. To generate ticks and grid lines, you'll need the inverse of that function, which of course is 10^-#&.

This use of ScalingFunctions has been shown before on this site (I wouldn't have been able to figure this out on my own!). I can't seem to find the relevant question right now, but I will add a link when I find it.

As soon as I posted the answer, I saw the comments from @GuessWhoItIs and @2012rcampion, respectively providing the link I couldn't find, and something very close to the solution I proposed here. Hopefully my explanation may still be useful to you.

  • $\begingroup$ Elegant and simple. Supremely helpful. Thanks. Can someone explain why ScalingFunctions as used is typeset in red with the warning "An unknown option name has been used"? $\endgroup$
    – dantopa
    May 27, 2015 at 15:53
  • 1
    $\begingroup$ @dantopa I'm glad the answer was helpful to you! As for the red part, it's just because ScalingFunctions is documented only for BarChart and Histogram (as far as I know), but other posts on this site have shown that it works with the *Plot functions as well, as an undocumented feature. However, since it is not listed explicitly as a valid option for those functions, the MMA front-end syntax highlighter will helpfully mark it in red to indicate that it thinks it "shouldn't be there". $\endgroup$
    – MarcoB
    May 27, 2015 at 15:59
  • $\begingroup$ @dantopa, to paraphrase an old saw: "if it looks broken and it works, then it ain't broken." $\endgroup$ May 27, 2015 at 16:17

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