0
$\begingroup$

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?

$\endgroup$
6
  • $\begingroup$ 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 $\endgroup$ Mar 20, 2014 at 18:50
  • $\begingroup$ @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! $\endgroup$ Mar 20, 2014 at 20:07
  • 1
    $\begingroup$ @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. $\endgroup$
    – Mr.Wizard
    Mar 21, 2014 at 1:58
  • $\begingroup$ @Mr.Wizard Ok. We disagree. I guess that's becoming an standard :) $\endgroup$ Mar 21, 2014 at 2:01
  • $\begingroup$ @belisarius Please remind me (sincerely), on what other issues have we disagreed recently? $\endgroup$
    – Mr.Wizard
    Mar 21, 2014 at 2:04

2 Answers 2

2
$\begingroup$

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

Show[
  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

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

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

$\endgroup$
1
  • $\begingroup$ That is exactly what I want. I tried pretty much every combination of that except the one that works. Thanks. $\endgroup$ Mar 21, 2014 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.