# How to transpose x and y axis on a LogLogPlot?

how can i exchange x and y Axis of this loglogplot?

x1[y_] := y+3
x2[y_] := y-1

myplot = LogLogPlot[{x1[y], x2[y]}, {y, 10^-4, 100}, PlotRange -> Full,
PlotPoints -> 10, PlotLegends -> "Expressions", ImageSize -> 600,
AspectRatio -> Full, Filling -> None]


this is a simple example, my real functions of X are very complicated and i can not find Y with explicit function of x.

1. Is there any way to switch the axis of this LogLogPlot?

2. How can I export this plot data point in a matrix?

• Why is the LogLog part relevant? – Dr. belisarius Jul 24 '15 at 18:26
• Its relevant because there is no ParametricLogLogPlot.. – george2079 Jul 24 '15 at 19:01
• related: mathematica.stackexchange.com/a/18669/2079. Note axisFlip does not work correctly however, but may be a start – george2079 Jul 24 '15 at 19:11

 y1 = InverseFunction[FunctionInterpolation[x1[y], {y, 10^-4, 100}]]
y2 = InverseFunction[FunctionInterpolation[x2[y], {y, 10^-4, 100}]]
LogLogPlot[{y1[x],y2[x]}, {x, 10^-3, 100}]


However I'm afraid FunctionInterpolation might not do a good job of sampling depending on your function.

You can do this:

 y1 = InverseFunction[x1]
y2 = InverseFunction[x2]
LogLogPlot[{y2[x], y1[x]}, {x, 10^-3, 100}]


But it might be painfully slow as it effectively iterates to find every plot point.

Here is a bit of a hack to fix the axes after using axisFlip: (LogLogPlot does something weird with PlotRange so you can't simply transpose the range as axisFlip does )

Show[LogLogPlot[ Null, {x, 3, 100},
PlotRange -> {{10^-3, 100}, {10^-4, 100}}], myplot // axisFlip]


• i couldn't use of axisFlip, the error is: "Could not combine the graphics objects in Show" – Alex Jul 24 '15 at 19:27
• you need to copy and evaluate the definition of axisFlip from the linked answer. – george2079 Jul 24 '15 at 19:32
• Wow, It works! you are lifesaving! – Alex Jul 24 '15 at 19:41
• @george209 Very nice! Could you elaborate on the "hack" required for LogLogPlot. It looks like maybe you are plotting nothing (Null) but setting the Axis needed for the flipped plot. Would you have to do something like this for LogPlot and LogLinearPlot as well? – Jack LaVigne Jul 25 '15 at 2:01

Use ListLogLogPlot with a list of values for from your functions.

points = Transpose[{{x1[#], #}, {x2[#], #}} & /@ Range[10^-4, 100, (100 - 10^-4)/200]];

ListLogLogPlot[points, Joined -> True]


I've used 200 plot points to get a nice smooth plot.

Hope this helps.

• Thanks a lot, but it is not work correctly for my complicated X functions. – Alex Jul 27 '15 at 20:11