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
Plot[{Sin[x], Cos[x]}, {x, 0, 10}, Mesh -> {{0, \[Pi]}}, 
     MeshShading -> {Black, Red}]

In the above, how can I specify that I want the mesh for just, say the Sine function and not the Cosine? I know I can use two plots and combine them with Show, but this is not what I want.

share|improve this question
Show[ {Plot[Sin[x], {x, 0, 10}, Mesh -> {{0, \[Pi]}}, MeshShading -> {Black, Red}], Plot[Cos[x], {x, 0, 10}, Mesh -> {{0, \[Pi]}}]}] – Dr. belisarius Feb 7 '13 at 16:59
@belisarius Isn't this what the OP explicitly says he doesn't want, or am I misreading this? – Sjoerd C. de Vries Feb 7 '13 at 21:52
@SjoerdC.deVries Yup. But my preferred shoe shop doesn't sell pairs of two right shoes unless you can convince them -with good reasons- – Dr. belisarius Feb 7 '13 at 21:59
Since your own answer has nothing to do with Mesh shall we assume that you just want output that visually matches the graphic shown in that answer? – Mr.Wizard Mar 10 '13 at 19:09
Related: – Mr.Wizard Mar 10 '13 at 19:12
Plot[{ConditionalExpression[Sin[x], 0 <= x <= Pi], 
      ConditionalExpression[Sin[x], Pi < x <= 10], Cos[x]}, {x, 0, 10}, 
      PlotStyle -> {Red, Black, Black}]

enter image description here

share|improve this answer
This doesn't use Mesh at all, in contrast to what the question title states. – Jens Feb 9 '13 at 0:14
It is a good answer if the real question is how to generate that plot... – SEngstrom May 9 '13 at 15:32

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.