Warning: possibly dumb question :-(

I have two functions I want to plot with the Filling option, like:

Plot[{Sin[t], Cos[t]}, {t, 0, 4 Pi}, Filling -> Axis]

That's OK. But if I only want the sine filled, and try

Plot[{Sin[t], Cos[t]}, {t, 0, 4 Pi}, Filling -> {Axis, None}]

MMA returns error messages that Axis and None are not valid Filling specifications. How can I selectively apply Filling?


1 Answer 1


Remember to look in the documentation when facing problems like this. Most options are well documented. For this case you could go to Filling and see that it states:

{i1->p1,i2->p2,...} fill from object ik to pk

So for your case you would write:

 Plot[{Sin[t], Cos[t]}, {t, 0, 4 Pi}, Filling -> {1 -> Axis}]
  • $\begingroup$ Thanks, jVincent. Easier than I anticipated. @J.M. - I had looked in the documentation, but stumbled over the fifth bullet item. Probably expected something more sophisticated. $\endgroup$
    – stevenvh
    Aug 16, 2012 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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