Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


...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?

share|improve this question
Can't you just change all y values into -y? Just do {#[[1]],-#[[2]]}& /@ pointList, with pointList the set of points to be plotted. – Sjoerd C. de Vries Jul 3 '12 at 22:21
I have filling in my plot, and I'm also doing a rotation (essentially I'm flipping about the y = x axis), so while what you suggest would work for the simple example I provided, it doesn't work in general for more complicated operations. – Guillochon Jul 3 '12 at 22:24
If you only need to flip a 2D image, then you can use ImageReflect – R. M. Jul 4 '12 at 2:36
up vote 12 down vote accepted

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}]]

    lp][[1]] /. {x_Real, 
    y_Real} :> {-x, y}, 
    AspectRatio -> .42*2.380952380952381]

Mathematica graphics

(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.

share|improve this answer

Few examples from the docs on ReflectionTransform used in combination with GeometricTransformation

  gr = Plot[ E^x, {x, -3, 2}]; 
  Row[{Show[gr, Plot[x, {x, -3, 7}, PlotStyle -> Black], 
   gr /. L_Line :> {Red, GeometricTransformation[L, ReflectionTransform[{-1, 1}]]}, 
   PlotRange -> All, ImageSize -> 200], 
   Show[gr, gr /. L_Line :> {Red, GeometricTransformation[L, ReflectionTransform[{-1, 0}]]}, PlotRange -> All, ImageSize -> 200], 
  Show[gr, gr /. L_Line :> {Red, GeometricTransformation[L, ReflectionTransform[{0, -1}]]}, PlotRange -> All, ImageSize -> 200]}, Spacer[15]]

enter image description here

 cow = ExampleData[{"Geometry3D", "Cow"}, "GraphicsComplex"];
 p1 = {0, 0, -0.25161901116371155`};
 p2 = {0, 0, 0.25161901116371155`};
 Row[{Graphics3D[{EdgeForm[None], Opacity[0.5], 
 Lighter[ColorData[1, 1], 0.5], cow, Lighter[ColorData[1, 2], 0.5], 
 GeometricTransformation[cow, #]}, Lighting -> "Neutral", 
 ImageSize -> Small, Boxed -> False] & /@
{ReflectionTransform[{0, 0, 1}, p1], 
 ReflectionTransform[{0, 0, 1}, p2],
 ReflectionTransform[{1, 0, 0}, p1], 
 ReflectionTransform[{1, 1, 0}, p1]}}, Spacer[15]]

enter image description here

share|improve this answer
wish I could upvote again for the cows – acl Jul 3 '12 at 23:19
Holy Flying Cows, Batman! – Dr. belisarius Jul 4 '12 at 4:48
can this be made to flip the axes? – acl Jul 4 '12 at 10:13
+1 There should be more answers on this site involving semi-transparent cows. – Simon Woods Jul 4 '12 at 11:21
@acl, @belisarius, @Simon, thanks for the votes. ReflectionTransform seemed gentle and safe .. but getting carried away with variations of examples featuring cows and transforms could expose one to animal cruelty charges (e.g. ShearingTransform). Simon, perhaps a semi-transparent cows blog:)? – kglr Jul 4 '12 at 21:01

You can actually use Scale for this by doing something like

MapAt[Scale[#, {-1, 1}] &, Plot[Sin[x], {x, 0, 2 Pi}] , {1}]

Mathematica graphics

share|improve this answer

There is a very simple way to "mirror" a function in the y-axis.

Just write $f[-x]$, where you need.


f[x_] = 2 x - 3;
Plot[Which[x > 0, f[x], x < 0, f[-x]], {x, -5, 5}, PlotRange -> All]

mirror in y-axis

To mirror a function in the x-axis you can place $-f[x]$, where you need.


f[x_] = 2 x - 3;
P1 =  Plot[f[x], {x, -5, 5}, PlotRange -> All];
P2 =  Plot[-f[x], {x, -5, 5}, PlotRange -> All, PlotStyle -> Red];
Show[P1, P2]

mirror in x-axis

share|improve this answer

Your Answer


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.