4
$\begingroup$

I am fitting a theoretical equation for a complicated curve to some experimentally measured data. As you might be aware, algorithmically quantifying 'goodness of fit' for a complicated curve is something of a dark art...

I want to load the experimental data and display it in a graph, and then over the top have a manipulable plot of the generated curve superimposed, so that I can tweak the parameters by eye until the fit looks good.

I can plot the measured data, and I can plot the manipulable curve from theory, but I need them to be plotted on top of each other!

I'm having trouble getting it to show the two graphs at once though... is it possible?

Many thanks, Ben

$\endgroup$
3
  • $\begingroup$ check out Show $\endgroup$ Commented Sep 2, 2013 at 13:17
  • $\begingroup$ Manipulate[ Show[ Plot[...], ListPlot[...]], {...}]. This question has been asked many times, and of course is a duplicate. $\endgroup$
    – Artes
    Commented Sep 2, 2013 at 13:20
  • $\begingroup$ Plot[ <<>>, Epilog -> Points@expdata is a good way too. $\endgroup$
    – Kuba
    Commented Sep 2, 2013 at 13:21

1 Answer 1

6
$\begingroup$

Show can help you, as in this example:

preMadePlot = Plot[Sin[x], {x, 0, 2 Pi}]
Manipulate[Show[
  preMadePlot,
  Plot[Sin[p x], {x, 0, 2 Pi}]
  ], {p, 1, 10}]
$\endgroup$
1
  • $\begingroup$ Thank you very much everyone! I was very close but misusing Show. Cheers! $\endgroup$
    – Ben
    Commented Sep 2, 2013 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.