I have a relatively simple operation I'd like to perform on a plot: I would like to reflect the plot across the x-axis. I do not have any tick labels, so making sure that the labels are not themselves reflected is not a concern.
Rotating the plot works as expected:
Rotate[ListPlot[{{0,0},{1,1}},Joined->True],90\[Degree]]
...but there does not appear to be a "Reflect" command or equivalent that performs a reflection operation. I've tried using GeometricTransformation and Scale, but both of those don't seem to work on plot objects. How should I go about doing this?
Answer
How about something like this (example shamelessly stolen from the docs)
f[n_, x_] :=
Abs[((1/Pi)^(1/4) HermiteH[n, x])/(E^(x^2/2) Sqrt[2^n n!])]^2
lp = Plot[Evaluate@
Append[Table[f[n, x] + n + 1/2, {n, 0, 7}], x^2/2], {x, 0, 4},
Filling -> Table[n -> n - 1/2, {n, 1, 8}]]
Graphics[FullGraphics[
lp][[1]] /. {x_Real,
y_Real} :> {-x, y},
AspectRatio -> .42*2.380952380952381]

(you said ticks aren't important so I ignored them). This is similar to Sjoerd's suggestion in the comments but for the whole plot.
Comments
Post a Comment