Re: question about plotting
- To: mathgroup at smc.vnet.net
- Subject: [mg119078] Re: question about plotting
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 21 May 2011 06:47:55 -0400 (EDT)
On 5/20/11 at 6:36 AM, krzysztof.kutak at googlemail.com (Krzysztof
Kutak) wrote:
>I would like to combine plot od datapoints in one
>dimension(for this I use ListPlot[data]) with fitted function ( f[r]
>). Do you know how to do this?
Here are a couple of ways:
First generate some data and a fitted curve
data = Sort@RandomReal[10, 10];
f = m x + b /. FindFit[data, m x + b, {m, b}, x];
Then create the plot
Plot[f, {x, 0, 11},
Epilog -> {PointSize[.015], Point[Transpose@{Range[10], data}]}]
Note, if the data were a 2D array the Epilog portion would have been
{Pointsize[.015],Point[data]}
or
Show[ListPlot[data], Plot[f, {x, 0, 11}]]