Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.
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]}}]}] – belisarius has settled 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- – belisarius has settled 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

1 Answer 1

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.