3

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?

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
TMH
  • 419
  • 5
  • 12

2 Answers2

8
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

Federico
  • 2,553
  • 16
  • 16
1

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}]
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574