For flipping the axes I use the following function:
Options[flippeAchsen] = Union[{Achsen -> 1}, Options[Graphics]];
flippeAchsen[pp_Graphics, opts : OptionsPattern[]] :=
Module[{tx, ty, labx, laby, GAPx, GAPy, qq, xyRule, x, y, achs,
TICKS, ticks, gropts, frame, FTall}, achs = OptionValue[Achsen];
If[achs > 3, FTall = True; achs = Mod[achs, 3, 1], FTall = False];
frame = OptionValue[Frame];
TICKS = If[frame === True, FrameTicks, Ticks];
gropts = Sequence @@ FilterRules[Flatten[{opts}], Options[Graphics]];
tx = AbsoluteOptions[pp, TICKS][[1, 2, 1]];
ty = AbsoluteOptions[pp, TICKS][[1, 2, 2]];
labx = Select[Flatten[Cases[tx, {n_, l_, rest__}]], NumericQ];
laby = Select[Flatten[Cases[ty, {n_, l_, rest__}]], NumericQ];
GAPx = Max[labx] - Min[labx];
GAPy = Max[laby] - Min[laby];
Which[achs == 1,(*x Achse*)
xyRule = {x_?NumericQ, y_?NumericQ} -> {GAPx - x, y};
ticks = {Map[{GAPx - First[#], Sequence @@ Rest[#]} &, tx], ty},
achs == 2,(*y Achse*)
xyRule = {x_?NumericQ, y_?NumericQ} -> {x, GAPy - y};
ticks = {tx, Map[{GAPy - First[#], Sequence @@ Rest[#]} &, ty]},
achs == 3,(*beide Achsen*)
xyRule = {x_?NumericQ, y_?NumericQ} -> {GAPx - x, GAPy - y};
ticks = {Map[{GAPx - First[#], Sequence @@ Rest[#]} &, tx],
Map[{GAPy - First[#], Sequence @@ Rest[#]} &, ty]}];
ticks =
If[frame === True,
If[FTall ===
True, {{ticks[[2]], ticks[[2]]}, {ticks[[1]],
ticks[[1]]}}, {{ticks[[2]], None}, {ticks[[1]], None}}], ticks];
Show[pp /. xyRule, Evaluate[gropts], Axes -> True, PlotRange -> All,
AxesOrigin -> AbsoluteOptions[pp, AxesOrigin][[1, 2]] /. xyRule,
TICKS -> ticks]]
The option Achsen choses the axes to flip:
Achsen->1
reverts the first (x-axis)
Achsen->2
reverts the second (y-axis
Achsen->3
reverts both
If you use FrameTicks
you must pass this option to flippeAchsen
too.
In frames the ticks are drawn bottom and left by default. If one want the Ticks on all four sides, just add 3 to the option Achsen
.
Call is: flippeAchsen[plot, Achsen->number]