Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

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'm new to Mathematica and some of the filling stuff is confusing me. I don't think this should be too hard but I can't seem to get it to work.

I have plotted x and -x. I want to fill below BOTH of them and above BOTH of them in two different plots. How can this be done?

share|improve this question
Please always try post some code. Did you manage to Plot the functions?: -Post it-. Do you have some filling code not working?: -Post it too- That way you get your question out of the dangerous "do it for me" zone – Dr. belisarius Mar 20 '14 at 18:50
@Kuba The folks aren't usually in danger since they tend to be farther than a frog's leap from a certain mod. But the questions are ... poor questions! – Dr. belisarius Mar 20 '14 at 20:07
@belisarius I have to disagree with you here. Adding code that doesn't work improves nothing in this case. Instead we need(ed) a graphic example of what was desired, even if it meant drawing it by hand and taking a photo. That would be effort and information that was not pointless. – Mr.Wizard Mar 21 '14 at 1:58
@Mr.Wizard Ok. We disagree. I guess that's becoming an standard :) – Dr. belisarius Mar 21 '14 at 2:01
@belisarius Please remind me (sincerely), on what other issues have we disagreed recently? – Mr.Wizard Mar 21 '14 at 2:04
up vote 2 down vote accepted

I don't know much about Filling, but what about something like

  RegionPlot[Abs[y] > Abs[x], {x, -2, 2}, {y, -2, 2}, Frame -> False],
  Plot[{-x, x}, {x, -2, 2}],
  Axes -> True

enter image description here

share|improve this answer
Nevermind I answered it myself with your hint. Thanks alot. – TheNumber23 Mar 20 '14 at 18:44
@TheNumber23 Would you please add your solution to your question? I'm still not certain what you want. – Mr.Wizard Mar 20 '14 at 18:54
@Mr.Wizard I did the exact same thing as you. But in I plotted Abs[y]>Abs[x]&&y<0. – TheNumber23 Mar 20 '14 at 18:56
@TheNumber23 I'm not RiemannZeta, but thanks for explaining. – Mr.Wizard Mar 20 '14 at 19:03

Based on your comments above I think you want this:

Plot[{-x, x}, {x, -2, 2},
  Filling -> {1 -> Bottom, 2 -> {{1}, White}}

enter image description here

share|improve this answer
That is exactly what I want. I tried pretty much every combination of that except the one that works. Thanks. – TheNumber23 Mar 21 '14 at 1:00

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.