1
$\begingroup$

I'm plotting multiple lists with ListPlot[] or ListLogPlot[]:

ListLogPlot[{ListA, ListB, ListC, ListD, ListE}, PlotRange -> {{0, 100}, Automatic}]

I also have fits, $(f_a,f_b,f_c,f_d,f_e)$ for the data in each of the lists. How can I overlay the fits in the same color and for the same $(x,y)$ range?

$\endgroup$
1
  • $\begingroup$ Could you post a minimal example ? $\endgroup$ May 5, 2013 at 11:41

1 Answer 1

1
$\begingroup$

Create some data:

data = Map[Sin[# Range@100] + # &, {1, 5, 3, 6}] // N;

Create some fits:

fits = LinearModelFit[#, g, g] & /@ data;

Plot the data:

g1 = ListLogPlot[data, PlotRange -> {{0, 100}, Automatic}, Joined -> True];

Plot the fits:

g2 = ListLinePlot[Log@Thread[#[Range[0, 100]]]& /@ fits, PlotRange->{{0, 100},Automatic}]

Combine the plots:

Show[g1,g2]

enter image description here

$\endgroup$

Your Answer

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

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