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 want to combine two plots which are in two regions. For an example, I want to plot following two figures in the same plot.

a = Plot[Cos[x], {x, 0, 60}]
b = Plot[Sin[x], {x, 60, 90}]

Could anyone please tell me how to do this without using Piecewise function?

share|improve this question
up vote 8 down vote accepted
a = Plot[Cos[x], {x, 0, 60}, PlotStyle -> Blue];
b = Plot[Sin[x], {x, 60, 90}, PlotStyle -> Red];
Show[a, b, PlotRange -> All]

Is this what you want?

plot

share|improve this answer
    
Thanks Federico. – TMH Mar 27 '13 at 0:31
    
You are welcome – Federico Mar 27 '13 at 0:34

Could anyone please tell me how to do this without using Piecewise function?

Cheating:

Plot[{ConditionalExpression[Cos[x], x <= 60], ConditionalExpression[Sin[x], x >= 60]},
     {x, 0, 90}, PlotStyle -> {Blue, Red}]
share|improve this answer

Your Answer

 
discard

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.