6
$\begingroup$

Let's say I have two manipulated plots:

Manipulate[Plot[Sin[a x], {x, 0, Pi}], {a, 0, 10}]
Manipulate[Plot[Cos[b x], {x, 0, Pi}], {b, 0, 10}]

How can I create a new plot that combines these two and is updated dynamically by each of them? Can I somehow use Show[]?

Of course I could create a unified manipulator, but in reality these are a handful of conceptually separate problems with lots of sliders each and I'd hate to duplicate them all.

$\endgroup$

2 Answers 2

7
$\begingroup$

This does what you want.

Manipulate[plots = Plot[Sin[a x], {x, 0, Pi}], {a, 0, 10}] 
Manipulate[plotc = Plot[Cos[b x], {x, 0, Pi}], {b, 0, 10}]
Show[plots, plotc] // Dynamic
$\endgroup$
4
  • $\begingroup$ OK good. Although Row[] seems a bit redundant here. :) $\endgroup$
    – nccc
    Oct 22, 2012 at 18:58
  • $\begingroup$ Good point - I've edited out the Row. $\endgroup$ Oct 22, 2012 at 22:32
  • $\begingroup$ Stripping off the braces too might leave on only the necessary. :P $\endgroup$
    – nccc
    Oct 23, 2012 at 8:24
  • $\begingroup$ Braces stripped, and the comma as well! $\endgroup$ Oct 24, 2012 at 13:41
5
$\begingroup$

The question is not very clearly posed but may be Panel is what you are looking for.

Panel[Manipulate[Plot[Sin[a x], {x, 0, Pi}], {{a, 2}, 0, 10}]
      Manipulate[Plot[Cos[b x], {x, 0, Pi}], {{b, 2}, 0, 10}], 
      FrameMargins -> 0]

enter image description here

$\endgroup$

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.